How to remove styles from a textmate scope in VSCode

Viewed 182

How can I remove the styles set on a textmate scope by a theme? The theme I am using sets a font weight on the storage.type.function scope, and I want to remove it so that it inherits from a parent scope.

Both keywords have the most specific scope as storage.type.function, which is set to bold by the theme.

I have used the two less-specific scopes meta.function and meta.function.closure to set regular and bold styles, however both these are overridden by the more specific storage.type.function scope set by the theme.

Thus to get my custom style to apply, I need to somehow remove the style set on storage.type.function so it falls back to the meta values I have set. Setting it to blank doesn't work:

{
    "workbench.colorTheme": "Solarized Dark",
    "editor.tokenColorCustomizations": {
        "textMateRules": [
            // Want to unset this style
            { "scope": "storage.type.function", "settings": { "fontStyle": "" } },

            // Neither of these apply because the one above overrides them
            { "scope": "meta.function",         "settings": { "fontStyle": "" } },
            { "scope": "meta.function.closure", "settings": { "fontStyle": "bold" } },
    ]
}

How can I unset storage.type.function so that the meta styles apply?

Here is some test PHP to reproduce the issue, save it as example.php and open it in VSCode:

<?php

class Test {
  function a() {           // "function" should not be bold (meta.function)
    $b = function () {};   // "function" should be bold (meta.function.closure)
  }
}
0 Answers
Related