Reputation: 17364
Does VSCode have shortcut to move to next method definition in the same file? I can't find anything like this in settings.
IntelliJ has this feature, for example, you can find this as Next Method in settings
Upvotes: 74
Views: 28275
Reputation: 116
I would like to have few notes about others solutions and my own:
Malks solution is great for MacOS this worked for me cmd+shift+.
Mishkin using a specific extension probably is the ideal solution, however it didn't work for me in MacOS tried to remap to my own shortcuts and config it still nothing worked.
Lex solution takes you to a specific line (which can be directly achieved by CMD+L
in MacOS).
Eventually the best solution for me at least is to start picking up the basics of VIM motions and install the Vim extension.
in my setting.json:
"editor.linernumber": "relative"
now in insert mode writing k+{line-number} will take me to the line immediately I want to go to
Without vim motion is possible you will use CMD+L
.
However, we would like to move from one function to the other in-which we will:
this highly dependable on your language thought (you can config and create your own binding).
In python you can use: ]m
and [m
. (readthis)
and so on.
Another option much easier than picking-up VIM-motions, is to use this extension Jump (Publisher: Wenfang Du)
It will send the cursoer to start/end of a specific word (you can use it mutliple times to reach a specific function).
OPT/ALT+Q OPT/ALT+W
: is the default to jump to end of a word (change this shortcut to somethign faster).
Upvotes: 0
Reputation: 800
Another option is to use Go to Symbol in Editor
default hotkey is Ctrl+Shift+o
.
Then type :
for sorting.
Upvotes: 23
Reputation: 1202
Old question, but I found interacting with the breadcrumb useful. ctrl-shift-.
takes focus to the breadcrumb and up and down arrows move through the outline, with the bonus that the editor follows.
Upvotes: 95
Reputation: 626
To achieve this I have developed an extension that provides two key commands to navigate up and down through the members in your file.
https://marketplace.visualstudio.com/items?itemName=mishkinf.goto-next-previous-member#overview
Visual Studio Code Extension to navigate through the functions, variables, and classes using quick and easy keycommands similar to functionality provided by IntelliJ IDE's (next/previous function) or Resharper (next/previous member)
Let me know if there any features you would like added.
Upvotes: 56