Collapse all #regions only(!) in C# (Visual Studio)

前端 未结 10 1708
予麋鹿
予麋鹿 2020-12-12 15:11

There\'s a number of keyboard shortcuts and menu commands to automatically expand or collapse all foldables in the current document. Ctrl+M, Ctrl

10条回答
  •  被撕碎了的回忆
    2020-12-12 16:04

    I know this is an old question, but here's an update for visual studio 2019:

    The Quick Tasks solution from @ygoe's answer does not work for Visual Studio 2019, because that version changed the way the Quick Task bar searches. Plus it was never the preferred solution to the original question, since you needed to type a quick action instead of having a keyboard shortcut.

    I found a different solution on the marketplace which does exactly the collapsing and expanding of all regions in the currently opened file with keyboard shortcuts: Collapse Region

    From the extension page:

    Default key bindings are (Ctrl+R, Ctrl+Num+) and (Ctrl+R, Ctrl+Num-). Can be changed in Tools->Options->Environment->Keyboard.

提交回复
热议问题