Skip to content

x/tools/gopls: add shadowing semantic token modifier #75368

@mateusz834

Description

@mateusz834

#75342 made me think that I so often catch shadow bugs early, because i have the shadow analyzer enabled, that it would be nice to have some better way to expose such functionality to users, such that these are not warnings, but as a hint.

This is not only about variable naming bugs, but I often get frustrated that url. does not give any autocomplete only to realize that I have declared an url variable.

It would be nice to have a way to give attention to some parts of code.

My proposition is we add a shadowing semantic token modifier, that is returned to the editor, when an identifier causes other identifier, from outer scope(s), to be shadowed.

Example:

Image

It requires (at least in nvim) some special configuration:

vim.api.nvim_set_hl(0, '@lsp.mod.shadowing', { bold=true, underline=true })

CC @adonovan

Metadata

Metadata

Assignees

Labels

FeatureRequestIssues asking for a new feature that does not need a proposal.ToolsThis 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

Issue actions