I know that Ctrl+} will take you to the corresponding brace in Visual Studio, but say I'm in the middle of a gigantic function and I don't know where the top or the bottom is, is there a shortcut to get directly to the function declaration?
void function() { //so many lines of code //can't see the top or the bottom curly brace //can i get to the top of the function with a shortcut? }
Go to Enclosing Block (Ctrl + Alt + UpArrow) allows you to quickly navigate up to the beginning of the enclosing code block.
If you don't change the scope then the Home key won't work. Then try using the Home key. It should work.
Go to Definition# You can go back to your previous location with the Go > Back command or Ctrl+Alt+-. You can also see the type definition if you press Ctrl (Cmd on macOS) when you are hovering over the type.
I have a fresh install of VS2017. As of 15.9.1, the default for me is Alt+Shift+[.
This is the shortcut for EditorContextMenus.Navigate.GoToContainingBlock
. So you may have to execute this shortcut multiple times if you are a few block layers deep, but it'll get you where you want to go.
Alt+Ctrl+UP
,Tab
,Tab
,Enter
This sequence will move you through Project selctor > Scope selector > Function selector > Current Function.
Ctrl+M
,Ctrl+M
This sequence will toggle between collapse/expand current block.
Place cursor at any line that is immediately enclosed by the function. Collapse. Place cursor at the end of the collapsed function, i.e after { ... }
. Expand the function to get to its last brace.
Note:
If you have difficulty in finding a line immediately enclosed by the function(for example, when the function has lots of nested blocks), you can always goto the beginning to collapse the function.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With