Repository navigation
Conversation
Highlight `<twig:…>` component tags like any other tag, and the
`props` and `component`/`endcomponent` tags inside `{% %}` blocks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for Symfony UX Twig Components to the
twiglanguage.<twig:…>component tags were left unhighlighted, becauseHtmlOpenTagPatternandHtmlCloseTagPatterndeliberately reject names containing:. They are now highlighted like any other tag:{% props size = 'md' %} <twig:Card class="mb-4"> <twig:block name="header">{{ title }}</twig:block> <twig:Button variant="outline" :disabled="busy" /> </twig:Card>TwigComponentTagPatternhighlights opening, closing and self-closing tags. Names accept the same characters as the Symfony UX lexer ([A-Za-z0-9_:@\-.]), sotwig:Card.Headerandtwig:@Acme:Alertwork too.propsandcomponent/endcomponenttags are added toTwigTagLanguage. In{% set x = component('Alert') %}the function call keeps its highlighting.Tests cover the tag forms, near misses (
<twigx:Alert>,<twig:>), and tags inside Twig comments and strings, which stay untouched.Not covered:
:prop="expr"values are not highlighted as Twig expressions. A<twig:…>tag inside an HTML attribute value or a JavaScript string is highlighted, exactly as a<div>is today.These changes were made with AI assistance, based on changes already in use in another project, and have been reviewed manually. Here the tag name follows the Symfony UX lexer's full character set, and the UX keywords are added to the existing Twig keyword list.