mao-santaella-rs / NightWolfTheme

🐺 Night Wolf, VsCode Theme by Mao
MIT License
35 stars 9 forks source link

Opt-In into Semantic Highlighting #36

Closed wtho closed 1 year ago

wtho commented 2 years ago

Describe the solution you'd like The Night Wolf themes should provide and explicitly enable semantic highlighting.

Externsion's package.json:

"semanticHighlighting": true

Semantic Highlighting is kind of a tokenization 2.0. Semantic Highlighting will ask the language server (if available) to run additional, better tokenization than using the static grammer. If a theme does not support semantic highlighting, the language server will never be triggered. If there is no language server available for a language, the simpler, grammer-based approach will be used.

See resources: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide

https://code.visualstudio.com/api/extension-guides/color-theme#semantic-colors

Semantic highlighting enriches syntax coloring based on symbol information from the language service, which has more complete understanding of the project. The coloring changes appear once the language server is running and has computed the semantic tokens.

https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview

To properly support semantic highlighting, additional tokens (see standardized set) have to be added to the themes. If the theme does not provide semantic theming for a token, vscode will use a fallback mapping.

Is your feature request related to a problem? Please describe. It is not really a problem. It is just better highlighting.

mao-santaella-rs commented 1 year ago

Hi @wtho, thanks for taking the time to make this issue. I added Semantic Highlighting to the theme, I added some tokens that are supported mainly for javascript,

  "semanticTokenColors": {
    "variable": "#ffdc96",
    "parameter": "#ffdc96",
    "type": "#dc8cff",
    "function": "#00dcdc",
    "function.declaration": {
      "fontStyle": "bold"
    },
    "method": "#00dcdc",
    "class": "#00dcdc",
    "class.declaration": {
      "fontStyle": "bold"
    },
    "class.defaultLibrary": "#9696ff",
    "property": "#cecece",
    "string": "#aae682",
    "number": "#ffb482",
    "regexp": "#dbd4ba",
    "comment": "#647882",
    "keyword": "#ff7878",
    "interface": "#dc8cff"
  }

this is the implementation, let me know if you need more tokens supported.

thanks again, and sorry for the delay