visual-studio-codekeyboard-shortcuts

Is there a keyboard shortcut in VSCode that allows me to navigate to the beginning/end of the current function scope?


Sometimes I'll be navigating inside of a Python function or class whose implementation spans across many lines and I'd like to navigate to the beginning or end of the scope without having to visually scroll and identify where it ends.

Thanks in advance

I've tried ctrl + shift + \ which really only works for navigating between brackets, so not all that helpful in my case where I'm using python, where logical blocks aren't scoped by brackets but by indentation


Solution

  • You could use the Go To Symbol command (which is bound by default to ctrl/cmd+shift+o) to search for the function and then jump to it, which would take you to the top, and then from there, if you want to jump to the bottom, use the Expand Selection command (which is bound by default to shift+alt/opt+right) to expand until you've selected the whole function, and then use the down or right arrow key to move to the end of the selection.

    Another workaround is to use the breadcrumbs bar, which you can open with ctrl+shift+. and then use arrow keys and enter.