1 year ago

#318895

test-img

Moseleyi

VSCode: Add token colour customisations to a syntax highlighter extension

I've been trying to create a test extension for a custom code highlighting.

The extension works perfectly fine but I am wondering how can I attach the token colour definitions, sort of like a default if people don't add it to the settings.json.

At first I thought I could do it in package.json in the contributes section but I can't get it to work.

Here's an example of what I'm trying to "attach" to my extension:

{"scope": ["source.qqql.scope"], "settings": {"foreground": "#aaaaaa"}},
{"scope": ["source.qqql.scope.type"], "settings": {"foreground": "#6997bf"}},
{"scope": ["source.qqql.scope.name"], "settings": {"foreground": "#555555"}},

I also tried adding it to

"configurationDefaults": {
  "[qqql]": {
    "editor.tokenColorCustomizations": [
      "textMateRules": [<here>]
    ]
  }
}

in the package.json but upon testing with F5 it didn't colorise the tokens.

I followed this topic: VS Code - Text formatting in a new language extension but I fear I'm missing a step or a crucial part of understanding how to do it. Any help would be appreciate it.

visual-studio-code

vscode-extensions

textmate

0 Answers

Your Answer

Accepted video resources