Skip to content

x/tools/gopls: setting semanticTokenTypes has no effect #71964

Closed
@dandehoon

Description

@dandehoon

gopls version

v0.18.1

go env

GO111MODULE='auto'
GOARCH='arm64'
GOBIN=''
GOCACHE='$HOME/Library/Caches/go-build'
GOENV='$HOME/Library/Application Support/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='arm64'
GOHOSTOS='darwin'
GOINSECURE=''
GOMODCACHE='$HOME/go/pkg/mod'
GOOS='darwin'
GOPATH='$HOME/go'
GOPROXY='https://proxy.golang.org,direct'
GOROOT='$HOME/sdk/go1.23.6'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='$HOME/sdk/go1.23.6/pkg/tool/darwin_arm64'
GOVCS=''
GOVERSION='go1.23.6'
GODEBUG=''
GOTELEMETRY='off'
GOTELEMETRYDIR='$HOME/Library/Application Support/go/telemetry'
GCCGO='gccgo'
GOARM64='v8.0'
AR='ar'
CC='clang'
CXX='clang++'
CGO_ENABLED='1'
GOMOD='$PROJECT_DIR/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -ffile-prefix-map=/var/folders/j0/w9h1x51j7wzddn_d34qfvycm0000gp/T/go-build1704160563=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Setting ui.semanticTokenTypes in my vscode settings due to Deprecation of noSemanticString and noSemanticNumber

"gopls": {
  "ui.semanticTokens": true,
  "ui.semanticTokenTypes": {
      "string": false,
      "number": false,
   }
}

What did you see happen?

strings have no highlighting for verbs like %v, %w...
Image

What did you expect to see?

have highlight normally.
Image

Editor and settings

"[go]": {
  "editor.semanticHighlighting.enabled": true,
  "editor.defaultFormatter": "golang.go",
  "editor.formatOnSaveMode": "file"
},
"gopls": {
  "formatting.gofumpt": true,
  "ui.diagnostic.analyses": {
    "composites": false,
    "unusedparams": false
  },
  "ui.navigation.symbolScope": "workspace",
  "ui.navigation.importShortcut": "Definition",
  "ui.semanticTokens": true,
  "ui.semanticTokenTypes": {
    "string": false,
    "number": false
  },
  "ui.codelenses": {
    "run_govulncheck": true,
    "gc_details": false
  }
}

Logs

But setting ui.semanticTokenModifiers works as expected.

"ui.semanticTokenModifier": {
  "string": false,
  "number": false
}

I also found a potential implementation error in this gopls function. It appears to be copying ⁠SemanticTokenModifiers instead of ⁠SemanticTokenTypes.

Metadata

Metadata

Assignees

Labels

ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions