javascriptvisual-studiovisual-studio-2015

Visual Studio Expand Method and All Child Scopes or Collapse Method Only?


I have recently begun using ctrl-m, o to collapse the file to definitions in large files. However I do not like that this also collapses other child scopes of the method e.g. if {}, for{} blocks etc.

What I would like is one of two possible solutions:

  1. Collapsing only collapses the method signatures, and leaves child blocks of the methods untouched (so that as soon as you expand the method, everything within it is expanded).
  2. After collapsing everything with ctrl-m, o expanding a single method (not the whole file) should expand all child scopes as well.

Does anyone know if this is possible with the current shortcuts or know of any plugins that will help? Note: I mainly work in javascript files in case that makes any difference.


Solution

  • You can collapse sections by highlighting them and using ctrl m, h

    Or to toggle whether the selection is open or closed, you can use ctrl m, m

    To expand everything within the function, you need to select (highlight) the function rather than just having the cursor on that line before you press ctrl m, m