Skip to content

x/tools/gopls: gopls semantic token registration problems #48600

Closed
@mattmassicotte

Description

@mattmassicotte

What version of Go are you using (go version)?

$ go version
go version go1.16.3 darwin/arm64

Does this issue reproduce with the latest release?

It does reproduce with gopls 0.7.2

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="arm64"
GOBIN=""
GOCACHE="/Users/matt/Library/Caches/go-build"
GOENV="/Users/matt/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/matt/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/matt/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/opt/local/lib/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/local/lib/go/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.16.3"
GCCGO="gccgo"
AR="ar"
CC="/usr/bin/clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/7w/6mwnkkbn6jvdl27ng11c9zf00000gn/T/go-build4006803649=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

I'm experimenting with the gopls semantic tokens support. I've enabled it in the server options, and things are working. But, I'm having an issue with the capability registration behavior.

gopls does not report a value for semanticTokensProvider. My understanding is this is intentional, and dependant on the result of a workspace/configuration request. This matches what I'm seeing.

However, with my default setup, my client was never receiving any client/registerCapability at all, for semantic tokens or anything else. It seems that my client must indicate that it accepts dynamic registration for the didChangeConfiguration client capability to receive any registrations at all.

Interestingly, my client is also passing in false for the workspaceFolders client capability. But, gopls is attempting to register workspace/didChangeConfiguration and workspace/didChangeWorkspaceFolders. I would have not have expected to see the workspace/didChangeWorkspaceFolders registration there. Perhaps this is an unrelated problem, but I figured I'd let you know just in case.

Activity

added
ToolsThis label describes issues relating to any tools in the x/tools repository.
goplsIssues related to the Go language server, gopls.
on Sep 24, 2021
added this to the Unreleased milestone on Sep 24, 2021
stamblerre

stamblerre commented on Sep 24, 2021

@stamblerre
Contributor

However, with my default setup, my client was never receiving any client/registerCapability at all, for semantic tokens or anything else. It seems that my client must indicate that it accepts dynamic registration for the didChangeConfiguration client capability to receive any registrations at all.

Interestingly, my client is also passing in false for the workspaceFolders client capability. But, gopls is attempting to register workspace/didChangeConfiguration and workspace/didChangeWorkspaceFolders. I would have not have expected to see the workspace/didChangeWorkspaceFolders registration there. Perhaps this is an unrelated problem, but I figured I'd let you know just in case.

Good catch on both of these--thank you for reporting! These are our mistakes, and I'll send a CL to fix them ASAP.

gopherbot

gopherbot commented on Sep 24, 2021

@gopherbot
Contributor

Change https://golang.org/cl/352055 mentions this issue: internal/lsp: use the correct dynamic registration booleans

locked and limited conversation to collaborators on Oct 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @mattmassicotte@stamblerre@gopherbot

        Issue actions

          x/tools/gopls: gopls semantic token registration problems · Issue #48600 · golang/go