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: use static modifier for unexported function/method semantic tokens #51154

Open
segevda opened this issue Feb 11, 2022 · 4 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository.

Comments

@segevda
Copy link

segevda commented Feb 11, 2022

Suggesting to use the static modifier for function / method semantic tokens. This will allow finer grained color customization:

static

This customization exists in proprietary IDE's like JetBrains GoLand, and can later be expanded to distinguish unexported types/variables/consts/etc from exported ones.

@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 Feb 11, 2022
@gopherbot gopherbot added this to the Unreleased milestone Feb 11, 2022
@findleyr
Copy link
Contributor

CC @pjweinb

@pjweinb pjweinb self-assigned this Feb 11, 2022
@pjweinb
Copy link

pjweinb commented Feb 11, 2022

This is a plausible improvement. I'll take a look.

@segevda
Copy link
Author

segevda commented Feb 12, 2022

This is a plausible improvement. I'll take a look.

Thanks @pjweinb . If you find that this is doable, I will be happy to implement the change.

@pjweinb
Copy link

pjweinb commented Feb 14, 2022

(this may be a duplicate; i thought i responded, but it's not here)
The Go language identifies exported (non-static) variables with capitalization, so for most purposes this proposal doesn't add information, although it would make the display more colorful. The place where it would add information is that capitalized variables local to functions or function signatures would be marked static (non-exported). These are rare. To the extent all that is true, I don't think it's worth touching the code at this time, but it would be worth adding a comment to the code, for the next time there's an extensive change, that all non-exported variables should have a 'static' modifier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest 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

5 participants