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

x/tools/gopls: semantic tokens appear to have broken since v0.13.2 #63415

Closed
flowchartsman opened this issue Oct 6, 2023 · 2 comments
Closed
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@flowchartsman
Copy link

flowchartsman commented Oct 6, 2023

gopls version

Build info
----------
Build info
----------
golang.org/x/tools/gopls v0.14.0-pre.2
    golang.org/x/tools/gopls@v0.14.0-pre.2 h1:5GvHcXCyjPrluj4QCG2tb8NPyNwDT5y52g53Z7d+Ou8=
    github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
    github.com/google/go-cmp@v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
    github.com/sergi/go-diff@v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
    golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
    golang.org/x/mod@v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc=
    golang.org/x/sync@v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
    golang.org/x/sys@v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
    golang.org/x/telemetry@v0.0.0-20231003223302-0168ef4ebbd3 h1:vxxQvncMbcRAtqHV5HsHGJkbya+BIOYIY+y6cdPZhzk=
    golang.org/x/text@v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
    golang.org/x/tools@v0.13.1-0.20231005170247-117a486e6b4a h1:+VSIj4o3PJNbcHbsFE9Elp24Hx6V5dSqBZ8FAKks+58=
    golang.org/x/vuln@v1.0.1 h1:KUas02EjQK5LTuIx1OylBQdKKZ9jeugs+HiqO5HormU=
    honnef.co/go/tools@v0.4.5 h1:YGD4H+SuIOOqsyoLOpZDWcieM28W47/zRO7f+9V3nvo=
    mvdan.cc/gofumpt@v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
    mvdan.cc/xurls/v2@v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
go: go1.21.2

go env

(taken from vscode Go: Locate Configured Go Tools output)

Workspace Folder (clarion): /Users/andy/devel/clarion
	GO111MODULE=''
	GOARCH='arm64'
	GOBIN=''
	GOCACHE='/Users/andy/Library/Caches/go-build'
	GOENV='/Users/andy/Library/Application Support/go/env'
	GOEXE=''
	GOEXPERIMENT=''
	GOFLAGS=''
	GOHOSTARCH='arm64'
	GOHOSTOS='darwin'
	GOINSECURE=''
	GOMODCACHE='/Users/andy/go/pkg/mod'
	GONOPROXY=''
	GONOSUMDB=''
	GOOS='darwin'
	GOPATH='/Users/andy/go'
	GOPRIVATE=''
	GOPROXY='https://proxy.golang.org,direct'
	GOROOT='/opt/homebrew/Cellar/go/1.21.2/libexec'
	GOSUMDB='sum.golang.org'
	GOTMPDIR=''
	GOTOOLCHAIN='auto'
	GOTOOLDIR='/opt/homebrew/Cellar/go/1.21.2/libexec/pkg/tool/darwin_arm64'
	GOVCS=''
	GOVERSION='go1.21.2'
	GCCGO='gccgo'
	AR='ar'
	CC='cc'
	CXX='c++'
	CGO_ENABLED='1'
	GOMOD='/dev/null'
	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/m4/ktknc01s62d5556jb375wjqh0000gn/T/go-build3589212960=/tmp/go-build -gno-record-gcc-switches -fno-common'

What did you do?

Originally submitted as a vscode-go bug (golang/vscode-go#3000), something appears to have changed between v0.13.2 and v0.14.0-pre.2 such that semantic tokens are not being correctly integrated into vscode-go. All tokens display type not in legend (ignored). This was discovered while using the Go Nightly exension, which was installing gopls v0.14.0-pre.2.

In my case, the issue was resolved by switching away from the nightly extension to the default and reinstalling the go tools with Go: Install/Update tools, which installed gopls v0.13.2, wherupon semantic tokens were restored.

What did you expect to see?

Semantic tokens.

What did you see instead?

semantic token type not in legend (ignored)
modifiers not in legend (ignored)

image

Editor and settings

  "[go]": {
    "editor.parameterHints.enabled": true,
  },
  "go.lintOnSave": "workspace",
  "go.coverageOptions": "showUncoveredCodeOnly",
  "go.enableCodeLens": {
    "runtest": true,
  },
  "go.toolsManagement.autoUpdate": true,
  "gopls": {
    "ui.semanticTokens": true,
    "formatting.gofumpt": true,
    "codelenses": {
      "gc_details": true,
    },
  },
@flowchartsman flowchartsman added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 6, 2023
@gopherbot gopherbot added this to the Unreleased milestone Oct 6, 2023
@hyangah hyangah modified the milestones: Unreleased, gopls/v0.14.0 Oct 6, 2023
@hyangah
Copy link
Contributor

hyangah commented Oct 6, 2023

This also results in breaking the part of Go template file support in vscode. The syntax highlighting of the Go template relies on semantic tokens - we don't have textmate-based syntax highlighting.

cc @pjweinb @findleyr

@findleyr
Copy link
Contributor

findleyr commented Oct 6, 2023

Thanks for the report. This is a dupe of https://go.dev/issue/63291; I haven't figured it out yet, but it is a high priority to do next.

@findleyr findleyr closed this as not planned Won't fix, can't repro, duplicate, stale Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

4 participants