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: typeDefinition: support more kinds of syntax #67890

Open
adonovan opened this issue Jun 7, 2024 · 0 comments
Open

x/tools/gopls: typeDefinition: support more kinds of syntax #67890

adonovan opened this issue Jun 7, 2024 · 0 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.
Milestone

Comments

@adonovan
Copy link
Member

adonovan commented Jun 7, 2024

The LSP typeDefinition query reports the location of the definition of a type. Currently, it requires a symbol, whose type it computes, and from which it then tries to pick the most salient named type. But there are lots of other expressions for which it could give useful information:

  • any expression
  • a struct field
  • imported package names.

gopls should support more of these.

(Unfortunately the LSP provides no way to support the "describe type" feature of the late cmd/guru, which reported the type of the selected expression: TypeDefinition only returns a location, and Hover does not accept a selection. So there's no way to ask the type of just the "f(x)" portion of f(x).y. We should lobby for LSP to add a selection to Hover.)

@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 Jun 7, 2024
@gopherbot gopherbot added this to the Unreleased milestone Jun 7, 2024
@adonovan adonovan changed the title x/tools/gopls: typeDefinitioon x/tools/gopls: typeDefinition: support more kinds of syntax Jun 7, 2024
@suzmue suzmue modified the milestones: Unreleased, gopls/backlog Jun 11, 2024
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

3 participants