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: Labels are treated as parameters when assigning semantic tokens #65494
Labels
Milestone
Comments
anthony-S93
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
Feb 3, 2024
The first choice for Go might be to do whatever vscode does for semantic
tokens of labels in Typescript.
…On Sat, Feb 3, 2024 at 8:17 AM Anthony Shi ***@***.***> wrote:
gopls version
0.14.2-1
go env
GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/anthony93/.cache/go-build'
GOENV='/home/anthony93/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/anthony93/Devfiles/.go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/anthony93/Devfiles/.go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.6'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/home/anthony93/Devfiles/testing/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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build410492386=/tmp/go-build -gno-record-gcc-switches'
What did you do?
Create a label called mylabel and then inspect the semantic token
assigned to it using an inspection tool.
What did you see happen?
The language server treats mylabel as function parameters rather than a
keyword or a variable.
On Neovim:
2024-02-03-21-05-49.png (view on web)
<https://github.com/golang/go/assets/69449791/5d57cfc1-85ad-450a-ae76-6509fd6012da>
On VsCode:
2024-02-03-20-56-53.png (view on web)
<https://github.com/golang/go/assets/69449791/016cdf97-19ec-4c59-a188-de43d9c966cc>
What did you expect to see?
I'm not sure if it's because I'm misinterpreting the language, but I don't
think labels and function parameters are semantically equivalent. I would
expect a more appropriate semantic token to be assigned to labels. Either
that, or don't assign any semantic tokens to labels at all—a syntax
highlighter like Treesitter can detect labels just fine since labels
require a special syntax.
Editor and settings
*No response*
Logs
*No response*
—
Reply to this email directly, view it on GitHub
<#65494>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJIAIYAWJD5HPMOOZYAR33YRY2H5AVCNFSM6AAAAABCYBBALOVHI2DSMVQWIX3LMV43ASLTON2WKOZSGEYTMNBXG44DGOA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Is there a workaround for this? I don't want to turn off semantic highlighting because I actually find it useful. |
there is nothing at the moment. (You can turn off semantic tokens for
strings and numbers.)
Is it the color that you don't like?
…On Sat, Feb 3, 2024 at 12:58 PM Anthony Shi ***@***.***> wrote:
The first choice for Go might be to do whatever vscode does for semantic
tokens of labels in Typescript.
Is there a workaround for this? I don't want to turn off semantic
highlighting entirely because I actually find it useful.
—
Reply to this email directly, view it on GitHub
<#65494 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABJIAI7LUQBO5NIQHEC74MDYRZ3CXAVCNFSM6AAAAABCYBBALOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRVGQYTINRRGU>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Change https://go.dev/cl/562244 mentions this issue: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gopls version
0.14.2-1
go env
What did you do?
Create a label called
mylabel
and then inspect the semantic token assigned to it using an inspection tool.What did you see happen?
The language server treats
mylabel
as function parameters rather than a keyword or a variable.On Neovim:
On VsCode:
What did you expect to see?
I'm not sure if it's because I'm misinterpreting the language, but I don't think labels and function parameters are semantically equivalent. I would expect a more appropriate semantic token to be assigned to labels. Either that, or don't assign any semantic tokens to labels at all—a syntax highlighter like Treesitter can detect labels just fine since labels require a special syntax.
Editor and settings
No response
Logs
No response
The text was updated successfully, but these errors were encountered: