How can I override a subscope of a theme in VS Code? I want to have different colors for different markdown heading levels.
My current theme (Bluloco Light) has the following rule in its json:
{
"name": "Headings",
"scope": [
"markup.heading", //my comment: bottom scope
// my comment: in between are heading.* scopes
"punctuation.definition.heading", // my comment: same level as entity...
"entity.name.section", //my comment: top scope, if I comment it out it works
"markup.heading.setext" //my comment: no idea
],
"settings": {
"fontStyle": "",
"foreground": "#c5a332"
}
},
If I add a textMateRule in my settings.json
:
"textMateRules": [
{
"scope": "heading.2.markdown",
"settings": {
"foreground": "#1E90FF",
},
},
]
the color remains #c5a332
.
It changes to #1E90FF
if I change the scope to "entity.name.section"
which is the top scope for the headings.
It also works if I comment out "entity.name.section"
in the themes json.
I think that the theme overrides "heading.2"
modification because the theme hooks on the most upper scope "entity.name.section"
.
Is there a way to do it without modifying the theme's json file?
You can use editor.action.inspectTMScopes
to inspect the TextMate scope stack on the tokens
You're wanting to space separate the scopes in textMateRules
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": "heading.2.markdown entity.name.section",
"settings": {
"foreground": "#1E90FF",
},
},
]
},