-
Notifications
You must be signed in to change notification settings - Fork 29.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reset styling for embedded languages in grammars? #33120
Comments
You essentially want to clear the scopes for the embedded language block right? @alexandrudima is quite familiar with the textmate scopes. |
Yes, I looked through some textmate grammars but didn't see any examples of this |
I'd argue that having red as default isn't wrong, it's still a string, after all. But themes are already free to define such rules such as setting the default background color for 'source' or 'meta.embedded' I'm against any tricks and customizations of our textmate coloring engine, we should stay compatible. But if you want to add something to our default rules, no problem. |
👍
|
Ok, sounds like proposed theme changes is the way to go. I'll look into trying this next iteration |
Fixes microsoft#33120 Adds rules to vs dark+light to reset style for meta embedded scopes. This is a proposed approach to support colorization of nested languages better
Fixes #33120 Adds rules to vs dark+light to reset style for meta embedded scopes. This is a proposed approach to support colorization of nested languages better
**Problem** VS Code themes currently hardcode a solution for reseting expression colorization inside of template string substitution expressions. This is not scalable since it js/ts specific With microsoft/vscode#33120 I've proposed that VS Code themes reset styling inside of meta.embedded scopes to support this across multiple languages **Fix** Marks template substitution expressions with the additional `meta.embedded.block.ts` scope
**Problem** VS Code themes currently hardcode a solution for reseting expression colorization inside of template string substitution expressions. This is not scalable since it js/ts specific With microsoft/vscode#33120 I've proposed that VS Code themes reset styling inside of meta.embedded scopes to support this across multiple languages **Fix** Marks template substitution expressions with the additional `meta.embedded.line.ts` scope
Problem
For grammars with embedded languages, the outside scope's colorization can leak into the embedded language:
The above example shows embedding the html grammar in a js template string. Notice that
text
is orange. No specific html grammar scope applies to it so it picks up the foreground color ofstring.template.js
Instead, in most cases I feel it would make more sense that
text
be colored the same at it would be in a normal html file, which in this case would be the default foreground color of the themePossible Approach
I've already fixed this issue for
${expressions}
in normal js template strings. Manually handling each language and embedded language combination will not scale however.One idea is to make themes treat the
meta.embedded
scope as a styling reset point. Themes would just use the same style formeta.embedded
as for the default:This works in my initial testing but may have unintended side effects. It also requires updating every theme
The text was updated successfully, but these errors were encountered: