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

Add 'label' to set of semantic tokens for Go

Open adonovan opened this issue 1 year ago • 1 comments

https://go.dev/cl/562244 adds support to gopls for classifying control labels as a semantic token class ("label"). Strangely, given that JavaScript uses labels just the same way as Go in break and continue, "label" does not appear to be an LSP 3.17 standard semantic token type.

I think the VS Code Go extension should define "label" as a supported token type, and register a unique CSS class for it, ideally with light and dark styles. Here's the logic to register 'enumMember' as a semantic token for TypeScript:

  • encoding https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/semanticTokens.ts//#L187
  • style https://github.com/Microsoft/vscode/blob/main/src/vs/platform/theme/common/tokenClassificationRegistry.ts#L567

This document suggests that VS Code already supports "label", so perhaps there is less to do: https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#standard-token-types-and-modifiers

@pjweinb

adonovan avatar Feb 07 '24 21:02 adonovan

Filed https://github.com/microsoft/vscode-languageserver-node/issues/1422 This is done by the LSP client library. I wish they could sneak this into the library without requiring us to wait for 3.18 LSP release.

hyangah avatar Feb 07 '24 22:02 hyangah