Closed aarondfrancis closed 2 years ago
Hi there!
This extension takes two approaches to syntax highlighting:
With the more granular parsing, this extension will look at your project's blueprints, as well as how the Antlers tags appear in the document, to determine "what kind" of styling to apply to it. In this case it looks like one of the default syntax rules has taken priority for name
.
Thanks for the response! I'm familiar with the tmLanguage approach, but not sure what the second approach is.
This snippet was taken from the Statamic docs and pasted into a scratch file, so there is no project blueprint to inspect, which makes me think it might be a tmLangauge issue? Maybe that name
is being picked up as a keyword where it shouldn't be?
Any ideas?
Thanks!
Doing a quick inspect, name
is being treated differently than style
from the tm grammar in this instance:
I will review the grammar file to see what should be done for out-of-box consistency - most likely will demote name
so it's picked up by the variable.other
rule
The style inspector can be opened by opening the command window and searching Developer: Inspect Editor Tokens and Scopes
(https://code.visualstudio.com/api/language-extensions/syntax-highlight-guide#scope-inspector)
For the 2nd approach that uses the parser results, VS Code refers to this as Semantic Highlighting (https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide) - and is pretty cool :)
Thanks for reopening, and for the helpful links. I'll give the semantic highlighting one a read for sure. I'm building https://torchlight.dev, so that seems kinda important 😂
Not a problem! I've been experimenting with torchlight.dev - it's pretty awesome, and will be keeping an eye on it!
Ha! Small world. Lemme know if you ever have any questions or I can help with anything 🤝
name
has been removed from the statamic-tag-native-variable
list in the grammar files to bring consistency here as of 1.0.24
.
I will leave this open as I need to set aside some time to go through the entirety of the grammar some more and fine-tune the rules
Amazing, thank you!
@aarondfrancis
Just a courtesy notice that the grammar has changed dramatically, and will be part of a production release of the extension soon
awesome, thank you for the heads up @JohnathonKoster!
Going to close this for now. Feel free to re-open/add comments/add new issues if you have any more questions regarding the highlighting 🙂
Hey 👋
First of all thanks for writing and maintaining this! It's a great resource.
I do have a question about syntax highlighting in one specific code block:
This was taken from the Statamic docs. Any ideas why
name
andstyle
are different?Thanks!