Skip to content
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

Adopt semantic highlighting #172

Closed
aeschli opened this issue Apr 23, 2020 · 3 comments · Fixed by #173
Closed

Adopt semantic highlighting #172

aeschli opened this issue Apr 23, 2020 · 3 comments · Fixed by #173

Comments

@aeschli
Copy link

aeschli commented Apr 23, 2020

Since 1.43, VSCode themes can take advantage of semantic highlighting.

Every theme controls whether semantic tokens are enabled. So far, only built-in themes have it enabled and I filed this issue to ask you to opt-in for the Nord theme as well.

Adoption is easy and there are new cool styling possibilities.

To turn on semantic highlighting for a theme, all you have to do is put
"semanticHighlighting": true
in the theme's definition file.

There's a good chance that no further change to the theme is needed (thanks to a default mapping from semantic tokens to TextMate scopes (if not, I'd be interested to know, so I can improve the defaults further)).

But, more interestingly, themes can tune and go wild by defining new styling rules against the semantic tokens:

"semanticTokenColors": {
    "variable.readonly": "#ff0000", 
    "parameter": { "fontStyle": "underline" },
    "*.declaration:java": { "fontStyle": "bold" }
} 

Check out our Semantic Highlighting Wiki and the Semantic Highlighting Guide for more details and feel free to ping me in this issue if I can help.

Thanks for the great work and looking forward to semantic highlighting in your theme.

@arcticicestudio
Copy link
Contributor

Hi @aeschli 👋, thanks for your contribution 👍
Nice to see you involve the community even more on this way 😄

I read release notes for my personal use as well as for changes related to the theme API every time a new VS Code version gets published. Therefore I've already created a note in the repository backlog to learn more about semantic highlighting. Also enabled it locally some weeks ago to take a quick look and disabled it again since it broke a lot of colors, but after reading through the latest change logs and PRs in the VS Code repository I guess this is fixed by now.

There are currently a lot other tasks for other projects and Nord ports as well as for my job due to the current world health situation, but I definitely planned to adapt to it within the next weeks.

@nomenon
Copy link

nomenon commented May 15, 2020

@arcticicestudio
Copy link
Contributor

@nomenon How is this related to this issue?


Status report so far after enabling semantic highlighting on my local machine and using it for some weeks: Works fine for different languages. I haven't had any issues or noticed any broken highlighting. Sometime it takes some seconds until the highlighting is updated, but this also depends on the current workload of the system as well as the project size and number of lines in the opened files.

I'll continue to use it locally until the weekend, but I guess it should be fine to merge the change and release a new extension version to roll it out to the users for more feedback.

arcticicestudio added a commit that referenced this issue Jun 16, 2020
Visual Studio Code version 1.44 introduced support [1] for
semantic highlighting [2] that allows to assign colors and
styles to tokens. Semantic highlighting enriches syntax coloring based
on symbol information from the language service, which has more
complete understanding of the project so the coloring changes appear
once the language server is running and has computed the semantic tokens.

The feature has been tested for some weeks and worked out-of-the-box
without the need to change or add specific matchers or rules.

[1]: https://code.visualstudio.com/updates/v1_44#_semantic-tokens-provider-api
[2]: https://code.visualstudio.com/docs/getstarted/themes#_semantic-highlighting
[3]: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#theming

GH-172
arcticicestudio added a commit that referenced this issue Jun 16, 2020
Visual Studio Code version 1.44 introduced support [1] for
semantic highlighting [2] that allows to assign colors and
styles to tokens. Semantic highlighting enriches syntax coloring based
on symbol information from the language service, which has more
complete understanding of the project so the coloring changes appear
once the language server is running and has computed the semantic tokens.

The feature has been tested for some weeks and worked out-of-the-box
without the need to change or add specific matchers or rules.
See the [semantic highlighting guide][4] and [GitHub wiki][5] for more details.

[1]: https://code.visualstudio.com/updates/v1_44#_semantic-tokens-provider-api 
[2]: https://code.visualstudio.com/docs/getstarted/themes#_semantic-highlighting
[3]: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#theming
[4]: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#theming
[5]: https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview

Closes GH-172
arcticicestudio added a commit that referenced this issue Jun 16, 2020
Visual Studio Code version 1.44 introduced support [1] for
semantic highlighting [2] that allows to assign colors and
styles to tokens. Semantic highlighting enriches syntax coloring based
on symbol information from the language service, which has more
complete understanding of the project so the coloring changes appear
once the language server is running and has computed the semantic tokens.

The feature has been tested for some weeks and worked out-of-the-box
without the need to change or add specific matchers or rules.
See the [semantic highlighting guide][4] and [GitHub wiki][5] for more details.

[1]: https://code.visualstudio.com/updates/v1_44#_semantic-tokens-provider-api 
[2]: https://code.visualstudio.com/docs/getstarted/themes#_semantic-highlighting
[3]: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#theming
[4]: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#theming
[5]: https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview

Closes GH-172
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants