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: inconsistent semantic token types for type parameters #56529

Closed
rink-grey opened this issue Nov 2, 2022 · 3 comments
Closed
Assignees
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@rink-grey
Copy link

rink-grey commented Nov 2, 2022

As example, the function has a generic typeParameter "T" and a parameter "target" .
iShot2022-11-02 23 51 27
Inside function, it check "target" as typeParameter that is error. Obviously "target" is a parameter.
iShot2022-11-02 23 51 54
iShot2022-11-02 23 52 13
And in the generic list, it check "T" as parameter, but in the parameter list, it check "T" as typeParameter. That is confusion
iShot2022-11-02 23 52 26
iShot2022-11-02 23 52 43

And my setting of gopls.ui.semanticTokens is turning on.

@findleyr
Copy link
Contributor

findleyr commented Nov 2, 2022

CC @pjweinb

I think it should be the other way around: target is a parameter, and T is a typeParameter (both in the type parameter list and parameter list).

@findleyr findleyr changed the title The semantic token check of parameter and typeParameter in function is error and confusion x/tools/gopls: inconsistent semantic token types for type parameters Nov 2, 2022
@findleyr findleyr transferred this issue from golang/vscode-go Nov 2, 2022
@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Nov 2, 2022
@gopherbot gopherbot added this to the Unreleased milestone Nov 2, 2022
@findleyr findleyr added the NeedsFix The path to resolution is known, but the work has not been done. label Nov 2, 2022
@findleyr findleyr modified the milestones: Unreleased, gopls/v0.11.0 Nov 2, 2022
@rink-grey
Copy link
Author

rink-grey commented Nov 3, 2022

@findleyr
yes, and inside the function body, "target" should be a parameter, not a typeParameter.
A parameter means a variable, and a typeParameter means a type.

CC @pjweinb

I think it should be the other way around: target is a parameter, and T is a typeParameter (both in the type parameter list and parameter list).

@gopherbot
Copy link

Change https://go.dev/cl/448375 mentions this issue: gopls/semantic: semantic tokens for type parameters

@golang golang locked and limited conversation to collaborators Nov 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. NeedsFix The path to resolution is known, but the work has not been done. 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