Skip to content

Use font-lock-preprocessor-face for annotations#209

Open
charjr wants to merge 3 commits into
godotengine:masterfrom
charjr:extract-annotations
Open

Use font-lock-preprocessor-face for annotations#209
charjr wants to merge 3 commits into
godotengine:masterfrom
charjr:extract-annotations

Conversation

@charjr

@charjr charjr commented May 24, 2026

Copy link
Copy Markdown
Contributor

Changes

Separates Annotations from keywords so they can use a different face.

before after
Screenshot From 2026-05-23 07-49-15 Screenshot From 2026-05-24 15-30-06

I picked the font-lock-preprocessor-face since GDScript TS Mode uses this already:

:language 'gdscript
:feature 'annotation
'((annotation "@" @font-lock-preprocessor-face
(identifier) @font-lock-preprocessor-face))

Side Note

The highlighting could be simplified to just take any string after an @ symbol, this would be more performant and less maintenance. But since the keywords exist and provide some additional completion, I just used them for now.

Simplified the regex to match Godot editor behaviour: Godot immediately highlights anything starting with @.

@charjr charjr force-pushed the extract-annotations branch from a34ebfc to 127aff4 Compare May 24, 2026 15:34
charjr added 2 commits May 24, 2026 16:44
Having the @ symbol made completion add a second @ symbol when
completing.

Though ideally completion should be filtered based on whether an @
symbol is present or not, that is out of scope for this commit.
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