Skip to content

x/tools/gopls: Missing defaultLibrary semantic token modifier for builtin interface types #70251

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

Closed
0DAYBROKER opened this issue Nov 7, 2024 · 3 comments
Assignees
Labels
gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@0DAYBROKER
Copy link

gopls version

Build info

golang.org/x/tools/gopls v0.16.2
golang.org/x/tools/gopls@v0.16.2 h1:K1z03MlikHfaMTtG01cUeL5FAOTJnITuNe0TWOcg8tM=
github.com/BurntSushi/toml@v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
github.com/google/go-cmp@v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
golang.org/x/exp/typeparams@v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
golang.org/x/mod@v0.20.0 h1:utOm6MM3R3dnawAiJgn0y+xvuYRsm1RKM/4giyfDgV0=
golang.org/x/sync@v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ=
golang.org/x/sys@v0.23.0 h1:YfKFowiIMvtgl1UERQoTPPToxltDeZfbj4H7dVUCwmM=
golang.org/x/telemetry@v0.0.0-20240829154258-f29ab539cc98 h1:Wm3cG5X6sZ0RSVRc/H1/sciC4AT6HAKgLCSH2lbpR/c=
golang.org/x/text@v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
golang.org/x/tools@v0.22.1-0.20240829175637-39126e24d653 h1:6bJEg2w2kUHWlfdJaESYsmNfI1LKAZQi6zCa7LUn7eI=
golang.org/x/vuln@v1.0.4 h1:SP0mPeg2PmGCu03V+61EcQiOjmpri2XijexKdzv8Z1I=
honnef.co/go/tools@v0.4.7 h1:9MDAWxMoSnB6QoSqiVr7P5mtkT9pOc1kSxchzPCnqJs=
mvdan.cc/gofumpt@v0.6.0 h1:G3QvahNDmpD+Aek/bNOLrFR2XC6ZAdo62dZu65gmwGo=
mvdan.cc/xurls/v2@v2.5.0 h1:lyBNOm8Wo71UknhUs4QTFUNNMyxy2JEIaKKo0RWOh+8=
go: go1.23.2

go env

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\redacted\AppData\Local\go-build
set GOENV=C:\Users\redacted\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\redacted\go\pkg\mod
set GONOPROXY=github.com/0DAYBROKER
set GONOSUMDB=github.com/0DAYBROKER
set GOOS=windows
set GOPATH=C:\Users\redacted\go
set GOPRIVATE=github.com/0DAYBROKER
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLCHAIN=auto
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.23.2
set GODEBUG=
set GOTELEMETRY=local
set GOTELEMETRYDIR=C:\Users\redacted\AppData\Roaming\go\telemetry
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=NUL
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=C:\Users\redacted\AppData\Local\Temp\go-build818586582=/tmp/go-build -gno-record-gcc-switches

What did you do?

I inspected the semantic token modifier in Visual Studio Code for the builtin interface type error by enabling "Developer: Inspect Tokens and Scopes".

What did you see happen?

The builtin interface type error only had one semantic token modifier: type.

What did you expect to see?

I expected to see two semantic token modifiers for the builtin interface type error. The modifier type and defaultLibrary.

Editor and settings

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

Logs

No response

@0DAYBROKER 0DAYBROKER 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 Nov 7, 2024
@gopherbot gopherbot added this to the Unreleased milestone Nov 7, 2024
@adonovan adonovan self-assigned this Nov 8, 2024
@adonovan
Copy link
Member

adonovan commented Nov 8, 2024

This is fixed by the same pending CL that will fix #66809.

@adonovan adonovan modified the milestones: Unreleased, gopls/v0.17.0 Nov 8, 2024
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/626279 mentions this issue: gopls/internal/golang: semtok: use type information consistently

dennypenta pushed a commit to dennypenta/tools that referenced this issue Dec 3, 2024
Previously there were two competing mechanisms for annotating
identifiers: the syntactic traversal and type information.
This meant that identifiers in different grammatical places
were annotated differently.

This change annotates identifiers using type information exclusively.
In addition to making things consistent, it also means that
types are reported independently (using modifiers) to symbol kind,
so, for example, a "var x func()" is a Variable with modifier
Signature, indicating that its type is a function.
Also, the rules for "defaultLibrary", "readonly", and so on
are more simply and consistently enforced.

The "deprecated" modifier is however lost as a consequence,
as it relied on the syntax.

+ Tests for both issues.

Also, use an enum for all the Modifiers.

Also, document the complete current set of token types
and modifiers that gopls returns.

Fixes golang/go#66809
Fixes golang/go#70251

Change-Id: I15e59d10f5a9269bc6be87f30e3502a9054d88e7
Reviewed-on: https://go-review.googlesource.com/c/tools/+/626279
Reviewed-by: Robert Findley <rfindley@google.com>
Reviewed-by: Peter Weinberger <pjw@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
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