Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Feature Request: open Peek References when Ctrl-click is on the symbol in its declaration #2451

Closed
inliquid opened this issue Apr 20, 2019 · 9 comments
Labels

Comments

@inliquid
Copy link

inliquid commented Apr 20, 2019

By default, with Ctrl-click you go to symbol definition, f.e. to a function declaration. When you make Ctrl-click on a declared name, VS Code in fact does nothing, which seems counter-intuitive. In most of the cases I need to Shift-F12 to see the usages of that symbol or if I want to go back from that place after some navigation happened around that symbol.

I think it would be very useful, if when you Ctrl-click on a function, variable, or a type name in a place where the symbol is defined, VS Code will open a Peek References of that symbol. This would be close to what Goland does by default and what I personally found extremely helpful.

I also found that as a kind of expected and intuitive behavior it actually works in some other extensions like CSS Peek. So I wonder, why not implement this for Go extension?

@ramya-rao-a
Copy link
Contributor

@inliquid This would be a feature request for VS Code itself as the keybindings for Go to definition, Find all references, Peek all references are defined in the core and not in the extension. This extension only provides implementation for these commands.

Therefore, please log your request at https://github.com/Microsoft/vscode

@inliquid
Copy link
Author

@ramya-rao-a but how is possible that CSS Peek does it from extension level?

@ramya-rao-a
Copy link
Contributor

Ctrl+Click -> Go to definition
Shift+F12 -> Peek references

Are you saying that CSS Peek allows peek references on Ctrl+Click?

@inliquid
Copy link
Author

@ramya-rao-a Ctrl-Click
изображение

@ramya-rao-a
Copy link
Contributor

Ctrl+Click is bound to the Go to Definition feature, i.e you are taken to the location where the symbol is defined
When Go to Definition returns multiple results, instead of navigating anywhere else, a peek window like you have shared is shown to the user with the multiple results.

Both these behaviors are implemented in VS Code core.
Extensions can only provide data when VS Code makes the request to the definition provider registered by the extension

The CSS Peek extension has registered a definition provider which returns those results that you see.

In the Go extension, we have registered a

  • definition provider that gives the location where the symbol is defined
  • reference provider that gives all the locations where the symbol is referenced

The keyboard bindings for these are set in VS Code core.

Hope this helps.

@inliquid
Copy link
Author

inliquid commented Apr 25, 2019

Still, it works in CSS Peek, so all these words above in the essence mean nothing.

@ramya-rao-a
Copy link
Contributor

I took another read at your original issue description.

What you are asking is for the Go to definition feature to run the Find all references feature when the cursor is already on the definition of the symbol in question. Is that right?

@inliquid
Copy link
Author

@ramya-rao-a yes

@ramya-rao-a
Copy link
Contributor

Ah! Understood.

This will still be useful coming from core VS Code as this feature is language agnostic. I would strongly suggest you to create an issue in the VS Code repo.

If it is concluded in that issue that each language extension is responsible for this, then I will re-open this issue.

Thanks for your patience.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants