Search code examples
visual-studioeditorvisual-studio-2019key-bindingsfolding

How can I set the same key to toggle the folding of the current block in Visual Studio?


I need to set on one single key (F1 specifically) both the collapse and the expand of the current block, in VS Pro 2019.

I thought I did it in the past, but I seem not to find it again anymore.

Simply binding both Edit.CollapseCurrentRegion and Edit.ExpandCurrentRegion doesn't work: one overwrites the other.

Ideally there should be a Edit.ToggleCurrentRegion but I couldn't find it.


Solution

  • Edit.ToggleOutliningExpansion 
    

    I think this should toggle expansion and collapsing of current region. By default it's Ctrl + M + M

    Check out more shortcuts here if needed https://learn.microsoft.com/en-us/visualstudio/ide/default-keyboard-shortcuts-in-visual-studio?view=vs-2019