Skip to content

fix(twig): highlight missing core Twig keywords - #248

Open
juliangut wants to merge 1 commit into
tempestphp:mainfrom
juliangut:fix/twig-missing-keywords
Open

juliangut wants to merge 1 commit into
tempestphp:mainfrom
juliangut:fix/twig-missing-keywords

Conversation

@juliangut

Copy link
Copy Markdown

Some core Twig keywords were not highlighted inside {% %} blocks:

{% if user is not null %}
{% include 'card.html.twig' with { title: 'x' } only %}
{% types { isOpen: 'bool' } %}
{% guard function importmap %}…{% endguard %}

Before, only if, include and with were highlighted. This adds is, not, only, types and guard/endguard to TwigTagLanguage.

Tests cover each keyword and the cases that must not change: is_granted(...), a property such as item.is, the words inside a string, and plain HTML text.

Not covered: {{ }} expressions (e.g. {{ user is not null }}), which use TwigEchoLanguage and have no keyword patterns at all.

These changes were made with AI assistance, ported from another project where they are already in use, and have been reviewed manually.

`is`, `not` and `only`, and the `guard`/`endguard` and `types` tags,
were left unhighlighted inside `{% %}` blocks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant