golang / vscode-go

Go extension for Visual Studio Code
https://marketplace.visualstudio.com/items?itemName=golang.Go
Other
3.88k stars 752 forks source link

commands: support the equivalent of vim-go's GoDefPop #203

Open lxstorm opened 4 years ago

lxstorm commented 4 years ago

If you have a question, please ask it on the #vscode or #vscode-go channels in Gophers Slack](https://invite.slack.golangbridge.org/messages/vscode).

Is your feature request related to a problem? Please describe. When use vscode to go to definition by serveral times mixing with some cursor move, then the jump back does not point the pre position where I call go to definition. This behaviour like vim's ctrl-o. hope a jump back tag stack feature like vim-go's ctrl-t (:GoDefPop)

Describe the solution you'd like use an additional definition stack, only jump definition can push into the stack, the jump back follows the stack's pop sequence

stamblerre commented 4 years ago

VS Code offers a Go Back command via the Command Palette (Ctrl+Shift+P). On the right side of the command name, you will see the keyboard shortcut for this command on your machine (on my Mac, it is Ctrl+-). Does that work for you?

This issue belongs in the https://github.com/microsoft/vscode repository, since the Go extension does not control VS Code's keyboard shortcuts or the behavior of VS Code's commands.

lxstorm commented 4 years ago

the Go Back is VS Code's default command, it use vs code's inner stack, can Go extension make another jump stack that store the definition's jump path, GoDefinition push the path both into the VScode's inner stack and go extension's definition stack, then another extension func maybe GoDefPop can back from extension's stack, so I can bind maybe ctrl-t to the GoDefPop

stamblerre commented 4 years ago

I'm not sure that such navigation commands are in the scope of this extension, but I'll let @hyangah make that decision.

I guess we can consider it, but I would like to understand how this would differ from Go Back. Can you give an example case of something Go Back does not handle as you would expect?

lxstorm commented 4 years ago
  1. move the cursor to time.Now()
  2. go definition, now cursor is on func Now(..)
  3. click some position on the same page
  4. scroll the page and click serval times
  5. scroll the page and click another some where

now use go back it will back to somewhere where I click the mouse, after serveral times I can back to time.Now() Jun-10-2020 14-22-26

Godefpop can jump back to time.Now() straightly

stamblerre commented 4 years ago

Thanks for clarifying the use case. This does sound like a useful feature, but we probably won't prioritize implementing it in the near future. We welcome contributions, so I'll add a help wanted label if you or or anyone else is interested in taking this up.