#Visual studio hotkeys for expanding code#
Hot Keys: CTRL+K+C for Bulk Comment & CTRL+K+C for Uncomment Manually adding and removing ‘//’ is tedious especially, if you have a long piece of code you want to deactivate.
CTRL+SHIFT+F5 lets you end the debugging session, rebuild it, and create a new debugging session. For example, if the insertion point lies inside a loop, the loop is hidden. This shortcut combines three debugging Visual Studio code commands in one. (C++) Collapses a region in the function containing the insertion point. ( Ctrl+ M, Ctrl+ O) - Collapses the members of all types. ( Ctrl+ M, Ctrl+ U) - Removes the outlining information for the currently selected user-defined region. ( Ctrl+ M, Ctrl+ P) - Removes all outlining information for the entire document. If some regions are expanded and some collapsed, then the collapsed regions are expanded. ( Ctrl+ M, Ctrl+ L) - Sets all regions to the same collapsed or expanded state. ( Ctrl+ M, Ctrl+ M) - Reverses the current hidden or expanded state of the innermost outlining section when the cursor lies in a nested collapsed section. To remove the custom region, use Stop Hiding Current (or Ctrl+ M, Ctrl+ U). ( Ctrl+ M, Ctrl+ H) - Collapses a selected block of code that would not normally be available for outlining, for example an if block. The following commands can be found on the Edit > Outlining submenu. For example, deletions or Find and Replace operations may erase the end of the region. When you change an outlined region, the outlining may be lost. You can also use Visual Studio Search (Ctrl+Q) and search for Keyboard. For example, when you copy a region that is collapsed, the Paste operation will paste the copied text as an expanded region. Currently Ctrl+M, Ctrl+E will expand a region and Ctrl+M, Ctrl+S will collapse a region. The Copy, Cut, Paste, and drag-and-drop operations retain outlining information, but not the state of the collapsible region. The Undo and Redo commands on the Edit menu affect these actions. When you do not wish to have outlining displayed, you can use the Stop Outlining command to remove the outline information without disturbing your underlying code. When you work in outlined code, you can expand the sections you want to work on, collapse them when you are done, and then move to other sections. You can change it in Tools > Options > Environment > Fonts and Colors > Collapsible Region. The default highlighting color may seem rather faint in some color configurations. Regions in the outlining margin are also highlighted when you hover over the margin with the mouse. You can see the contents of a collapsed region as a tooltip when you hover over the collapsed region. To collapse an outlining region, double-click any line in the region on the outlining margin, which appears just to the left of the code. If you are a keyboard user, you can choose Ctrl+ M+ M to collapse and expand.