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: jump to definition on 'return' should go to the result parameter list #70462

Open
findleyr opened this issue Nov 20, 2024 · 6 comments
Labels
FeatureRequest gopls Issues related to the Go language server, gopls. help wanted Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Member

Frequently, when I'm looking at a return statement, I want to jump to the function signature.

In the category of "more LSP operations should work, more of the time", we could make jump to definition on a return statement go to the result parameter list.

@findleyr findleyr added this to the gopls/backlog milestone Nov 20, 2024
@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 20, 2024
@mateusz834
Copy link
Member

This would be also nice for break and continue, maybe goto, but not realy needed, because we can always go to definition of the label (it is required).

@findleyr
Copy link
Member Author

@mateusz834 we can do that too. I think whenever there is an obvious possible result for an LSP operation at a position, we should return it. It is a good UX when more operations work, more of the time.

@xzbdmw
Copy link

xzbdmw commented Nov 24, 2024

How about make hover works for return to show function signature.

@findleyr
Copy link
Member Author

How about make hover works for return to show function signature.

That's a great idea, too. Hover is probably more useful than definition, actually, but we can do both.

@findleyr
Copy link
Member Author

Hmm, although I do find that hover to be distracting in some editors. In my editor, I make it a manual operation, bound to a keystroke. I wonder if we should be cautious about popping up hover dialogs over everything.

@xzbdmw
Copy link

xzbdmw commented Nov 25, 2024

In fact, gopls is already conservative in hover -- rust-analyzer shows definition for every keyword.
Users are able to configure a debounce for hover request, so this should not be a big problem.

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. help wanted 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