Vscode: Semantic highlighting improvements for 1.43.1

Created on 15 Mar 2020  路  9Comments  路  Source: microsoft/vscode

As mentioned in https://github.com/microsoft/vscode/wiki/Semantic-Highlighting-Overview#semantic-highlighting, the goal is to improve the first impression of semantic highlighting as well allow themes to opt-in to semantic highlighting.

  • give themes a way to opt-in to semantic highlighting
  • enable semantic coloring by default only the built-in themes. All other themes can be enabled by the theme author or in the user settings.
  • show a notification when semantic coloring shows up the first time. The notification will point to the docs with background and information on how to configure the feature.
  • fix the bugs found related to wrong token classification and color lookup.
  • no longer show semantic color in imports
candidate semantic-tokens verified

Most helpful comment

no longer show semantic color in imports

What are the reasons? It would be nice to know what most theme creators think, not just a few. Maybe some of us would like to use it

A configuration could be added to enable or disable that feature:

"editor.semanticHighlighting.imports": true

All 9 comments

give themes a way to opt-in to semantic highlighting

I like this feature. I think an individual config is better than a global one because it will allow us to use non-maintained themes that have semantic highlighting disabled and themes that have it enabled, without having to set the global config every time we change from a theme that uses it to one that doesn't

enable semantic coloring by default only the built-in themes

It's a good default setting

no longer show semantic color in imports

What are the reasons? It would be nice to know what most theme creators think, not just a few. Maybe some of us would like to use it

A configuration could be added to enable or disable that feature:

"editor.semanticHighlighting.imports": true

Changes pushed.

To verify:

  • create TypeScript file function foo() { const x = () => {}; const y = x; }.
  • If semantic color is enabled, foo, x and y all get the function color
  • Open a built-in in theme, semantic color should be enabled
  • verify that the very first time the semantic colors are show, a notification dialog is shown
  • Install a theme from the marketplace (e.g. Atom One Dark), semantic color should be disabled.
  • try
    "editor.tokenColorCustomizations": {
        "[Atom One Dark]": {
            "semanticHighlighting": true
        }
    }

and

    "editor.tokenColorCustomizations": {
        semanticHighlighting": true
    }

semantic highlighting should be enabled

  • verify
var fs  = require('fs'); // require shown as function
require.resolve('fpop/bat'); // require shown as variable
Promise.resolve(null) // Promise shown as class

~Now that semantic highlighting is opt-in on a per theme basis, is there any way for a user to override that? I use Monokai Pro, which hasn't been updated in quite some time, and the developer seems fairly inactive now. The semantic highlighting was working great on 1.43, and I'd like to get it back now that it's been disabled in 1.43.1.~

~I tried adding~

    "editor.tokenColorCustomizations": {
        "[Monokai Pro]": {
            "semanticHighlighting": true
        }
    }

~to my user config, but that didn't work.~

Edit: The above actually did work, except that semantic highlighting doesn't work on imports. I see now that this is the intended behavior. But why is semantic highlighting no longer available for import statements?

Make sure to also remove "editor.semanticHighlighing": false

Sorry, I was able to get semantic highlighting working by setting the config in my previous reply. But I'm wondering if it's possible to re-enable semantic highlighting on imports. On 1.43, variable names in import statements in Javascript would be highlighted based on their type. But on 1.43.1 with semantic highlighting enabled, import lines are no longer highlighted, as noted in your original message.

@DanielPower #93017

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sijad picture sijad  路  3Comments

sirius1024 picture sirius1024  路  3Comments

omidgolparvar picture omidgolparvar  路  3Comments

biij5698 picture biij5698  路  3Comments

shanalikhan picture shanalikhan  路  3Comments