Did you know... how to collapse and expand code? - #035
Yesterday’s tip talked about how to cut a collapsed block of code, but how do you collapse a block of code anyways?
There are basically five commands for "outline toggling," which can be found on the Edit – Outlining menu.
#1 – Toggle Outlining Expansion
By Pressing Ctrl+M, Ctrl+M anywhere within the code block, you can toggle between expanding and collapsing the given block of code.
#2 - Toggle All Outlining
By Pressing Ctrl+M, Ctrl+L anywhere in the editor, you can toggle between expanding and collapsing the entire file. When completely collapsed, you can then drill down into the section of code you are most interested in. When completely expanded, you can view all code without having to expand any sections.
#3 – Stop Outlining
By Pressing Ctrl+M, Ctrl+P anywhere in the editor, you can turn off outlining.
#4 – Start Outlining
Unfortunately, start and stop outlining are not the same command, so you can’t toggle between one state and the other. Additionally, using the general development settings, start is not bound to a keyboard shortcut. So, you will need to go to Edit – Outlining – Start Automatic Outlining to turn on outlining again.
#5 – Collapse to Definitions
In my opinion, this is the most useful command of all outlining (mostly because it was the only one I used… except for when I had to test the others). This allows you to quickly glance at all of your functions.
Lastly, if these keyboard shortcuts don’t match what you have, it is because you are using a different set of default settings that you chose on your first launch of Visual Studio. I’m using the General Development Settings for all these tips.
Technorati tags: VS2005Tip, VS2008Tip
Comments
Anonymous
October 08, 2007
For some time I have been subscribing to Sara Ford's blog where she shares useful tips for VisualAnonymous
January 14, 2008
Yesterday's tip was everything you ever wanted to know about outlining in the editor. Today, we'll exploreAnonymous
July 06, 2008
The comment has been removedAnonymous
July 06, 2008
この記事を 3:00 AM PST に公開するつもりだったのに、3:00 PM PST に設定していました。遅くなって申し訳ありません。 昨日のワンポイント では、折りたたまれたコード ブロックを切り取る方法をご紹介しました。では、コードAnonymous
September 11, 2008
Вчерашний совет рассказывал о том, как вырезать свернутый сегмент кода, но как его свернуть? На самом