Skip to content

fix(yaml): highlight keys containing dots, at signs and backslashes - #246

Open
juliangut wants to merge 1 commit into
tempestphp:mainfrom
juliangut:fix/yaml-symfony-keys
Open

juliangut wants to merge 1 commit into
tempestphp:mainfrom
juliangut:fix/yaml-symfony-keys

Conversation

@juliangut

Copy link
Copy Markdown

Keys containing ., @ or \ were only highlighted from their last segment, which is common in Symfony configuration:

when@test:
    cache.app: ~
    App\Service\Mailer: ~

Before: when@<keyword>test</keyword>: (colon left unhighlighted), cache.<keyword>app</keyword>:, App\Service\<keyword>Mailer</keyword>:.
After: the whole key is highlighted, and so is the colon.

YamlPropertyPattern and YamlColonPattern now accept those characters. Added pattern tests and a language test, which also checks that quoted values and comments containing a.b@c: stay untouched.

Known limitation, unchanged: an unquoted value containing a colon, such as host: example.com:8080, still highlights the part before the colon (previously com, now example.com).

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

Keys such as `when@test:`, `cache.app:` and `App\Service\Mailer:` were
only highlighted from their last segment, and the colon was left
unhighlighted after an `@`.

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