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

Wrong token colors display in editor #89174

Closed
awerlogus opened this issue Jan 23, 2020 · 11 comments
Closed

Wrong token colors display in editor #89174

awerlogus opened this issue Jan 23, 2020 · 11 comments
Assignees
Labels
terminal Integrated terminal issues

Comments

@awerlogus
Copy link

awerlogus commented Jan 23, 2020

Issue Type: Bug

description:

While "Initializing JS/TS language features" message is shown, everything works right.
screenshot1
But, after initialization, some tokens (type and function names) somehow become colored as plain text.
screenshot2
Meanwhile token colors are still inferred right.
screenshot3

Steps to reproduce:

  1. Install Onyx theme
  2. Open any .js/.ts file
  3. Write any function
  4. Reload window

VS Code version: Code - Insiders 1.42.0-insider (c4d53a1, 2020-01-23T05:39:57.148Z)
OS version: Windows_NT x64 10.0.18363

System Info
Item Value
CPUs Intel(R) Core(TM) i7-6500U CPU @ 2.50GHz (4 x 2592)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
viz_display_compositor: enabled_on
viz_hit_test_surface_layer: disabled_off_ok
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.87GB (2.35GB free)
Process Argv .
Screen Reader no
VM 0%
@vscodebot vscodebot bot added the terminal Integrated terminal issues label Jan 23, 2020
@NovaLogicDev
Copy link

Been having the same issue, doesn't seemed to be tied to anything but the initialization of JS/TS language features. Probably related to #77140 as I'm not seeing the issue in non insider builds. This also has nothing to do with the integrated terminal.

@NovaLogicDev
Copy link

I spent a moment and realized that this issue is not just effecting colors within the document but also the appearance of those tokens in the code minimap. notice the missing pieces of code on in the screenshots below.

Annotation 2020-01-23 150344
Annotation 2020-01-23 150345

@awerlogus
Copy link
Author

awerlogus commented Jan 25, 2020

Version: 1.42.0-insider (system setup)
Commit: f3dbcea
Date: 2020-01-24T05:38:14.538Z
Electron: 7.1.7
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Windows_NT x64 10.0.18363

In the latest release function and type names are colored right, but this time variables became blue (because of wrong color inference only?)

While "Initializing JS/TS language features" message is shown, everything works right.
изображение

After initialization variables become colored blue
изображение

Color of variables is inferred wrong
изображение

Even if we force the color of token, it doesn't help
изображение

@aeschli
Copy link
Contributor

aeschli commented Jan 27, 2020

Thus is caused bugs in by semantic highlighting that was just added. Some fixes have already gone in:

  • I improved the Inspect Hover to show the rule that was matched in the theme. Because the token got a semantic token of type variable, we look for a theming rule matching scope variable.
  • There's a bug with colors that have alpha components. that's fixed in tomorrows build.

Sorry for the trouble and I hope we get all the issue fixed soon. Please let me know if you still see issues with tomorrows I-Build.

If you want to turn off semantic highlighting, you can use "editor.semanticHighlighting.enabled": false

@awerlogus
Copy link
Author

awerlogus commented Jan 27, 2020

Sorry for semi-offtop, but can you make a feature with semantic detection of functions assigned to constants? I want all functions to be colored the same, but in some cases (when I return lambda expression from another function, for example) function selector is not being added to the token. (screenshots are made without of semantic highlight)
изображение
изображение
изображение

@awerlogus
Copy link
Author

Also I realized just now that information about colors of tokens doesn't depend on "editor.semanticHighlighting.enabled" setting


изображение
изображение
изображение

@aeschli
Copy link
Contributor

aeschli commented Jan 28, 2020

Also I realized just now that information about colors of tokens doesn't depend on "editor.semanticHighlighting.enabled" setting

Oh, yes, that's a bug that I wanted to fix

can you make a feature with semantic detection of functions assigned to constants

That's #89337

@NovaLogicDev
Copy link

Looking at todays build with semantic highlighting enabled and I'm seeing the same issue, no apparent improvement.

image

@NovaLogicDev
Copy link

Bug seems to be resolved in todays build

image

@SPGoding
Copy link
Contributor

SPGoding commented Feb 2, 2020

VSCode Info Version: 1.42.0-insider (user setup)
Commit: be0aca7
Date: 2020-01-31T13:53:58.701Z
Electron: 6.1.6
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Windows_NT x64 10.0.18363

Though I don't have this problem with TS/JS, I encountered this with my own language server:

bug

The Inspect Hover told me that these tokens in the second line were applied correctly, but they did not have the specific color. This happened after I deleted some tokens in the end of the last line.

I was using the SemanticTokensBuilder provided by vscode-languageserver package to build edits.

@aeschli
Copy link
Contributor

aeschli commented Feb 5, 2020

I think all the mentioned issues got fixed.

  • issue with colors and alpha
  • don't render semantic tokens white if there's no color rule for it
  • inspect hover improvents

Please file a new issue if you still see problems with semantic colors in TypeScript.

@SPGoding Please file a separate issue with the info of what tokens are created.

@aeschli aeschli closed this as completed Feb 5, 2020
@vscodebot vscodebot bot locked and limited conversation to collaborators Mar 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
terminal Integrated terminal issues
Projects
None yet
Development

No branches or pull requests

4 participants