Search code examples
visual-studio-codekeyboard-shortcuts

Is there a way to always stay at the searched-for Symbol location when using vscode and pressing `esc` key?


Let's say I use Go to Symbol in Editor. Let's further say I have a function def run(): (this is Python) that I want to jump to.

If I type @run in the Symbol search dropbox, the viewport will shift to def run in the source code.

So far, so I good. I have found what I want!

At that point, if I press esc I jump back to my starting location, rather than staying at def run() in the source. I have to remember to press Enter to get out of Go to Symbol in Editor... and stay at my location.

How can I make it so esc, by itself, always leaves me where I have found the symbol in the text?

I.e. I want to get more the behavior I get from using Edit, Find where esc leaves at the pattern location. And pressing Enter when in Find mode jumps me to the next pattern hit, if any.

environment: macos, vscode 1.63.2 (latest as of now)

p.s. You also get the same behavior from a Go to Line/Column... dialog, esc will yank you back to your starting point, Enter will leave you at the new location.


Solution

  • I'm afraid it's not currently possible. I've tried to unbind every single keyboard shortcut bound to Escape key so it should basically become a dead key, yet even with this setting symbol suggest highlight were cancelled by pressing the Escape, so no luck.

    Unbinding the primary action is normally prerequisite for changing default behaviour -- in your case for mapping it to "accept highlighted symbol" action (which I haven't found either) -- so it seems that Enter/Escape behaviour of symbol palette is not exposed for remapping.