vscode-go icon indicating copy to clipboard operation
vscode-go copied to clipboard

syntax highlight: strange code colorization in nightly extension

Open zzjin opened this issue 4 years ago • 7 comments

When try to test dlv-dap, I update vscode-go extension from stable to nightly, but found code colorization strange on vars and func names. vacode version:

Version: 1.57.0-insider (user setup)
Commit: fe23c2041f848d6c2f6bd27875112a37bcc82f84
Date: 2021-05-06T05:16:25.564Z
Electron: 12.0.4
Chrome: 89.0.4389.114
Node.js: 14.16.0
V8: 8.9.255.24-electron.0
OS: Windows_NT x64 10.0.21370

origin vscode-go: version: v0.24.2 screenshot: image

nightly version:`` screenshot: image

is this change of green color by design?

zzjin avatar May 06 '21 08:05 zzjin

Thanks for the report. Can you please share your settings (anything involving "gopls" and "editor.semanticHighlighting.*" and theme setup), and the gopls trace captured following the instruction? I suspect gopls's semantic token is enabled automatically in the nightly.

hyangah avatar May 06 '21 14:05 hyangah

@stamblerre told me that semantic toke is enabled in Nightly by default. I verified it too. @zzjin You can disable this feature explicitly by configuring in settings.json.

"gopls": {
  "ui.semanticTokens": false
}

But we are currently experimenting this new feature and looking for feedback. Do you think this color change is undesirable or distracting? What do you think?

hyangah avatar May 06 '21 15:05 hyangah

@hyangah thanks for response. setting ui.semanticTokens false rebase normal.

I use vscode's default dark theme and not set any other semanticHighlighting settings.

IMO, the new semanticTokens changes some 'same color for same mean' behavior: (just example)

  1. import path string is in double quote, but last path is not as same color as prefix path. (as shown below)
  2. funcs are yellow, but struct impl func are green: image

zzjin avatar May 07 '21 03:05 zzjin

Yeah, we are still unclear how themes and vscode assign colors for tokens yet.

cc @pjweinb

hyangah avatar May 07 '21 13:05 hyangah

The change in color for the last component of an import is intended. If the code says import "a/b/c" then uses of the package look like c.fn() That is, the coloring shows the namespace of the import.

pjweinb avatar Jan 17 '22 21:01 pjweinb

I actually love ui.semanticTokens, especially that packages now have a different color vs vars, but there are definitely a few weird colorings. Adding to what was already mentioned above, nil now has the color of variables, when using the default Dark+ theme but on the other hand many color themes don't support the coloring of theme package name in the import

Hades32 avatar Apr 27 '22 07:04 Hades32