0

In Visual Studio there is a user defined collapsible region creation shortcut Ctrl+M+H. I really love this shortcut.

I am aware of this question regarding foldings. However I really wish there was a way to collapse / fold the selected text section of the code in VS Code. Is there any way of doing this?

EDIT:

I see the feature request on VSCode.

Shintaro Takechi
  • 1,215
  • 1
  • 17
  • 39
  • 1
    Have a look at https://marketplace.visualstudio.com/items?itemName=maptz.regionfolder – Mark Apr 08 '20 at 03:56
  • Thank you very much for your suggestion! This is definitely nice. I will use it! Ultimately though, I wish they would have the shortcut ported. – Shintaro Takechi Apr 08 '20 at 07:02
  • Also see https://stackoverflow.com/a/71991706/836330 for a simpler solution. – Mark Apr 24 '22 at 21:56

1 Answers1

0

To fold selected text, use this command, new as of Insiders v1.70:

Create Manual Folding Range from Selection
editor.createFoldingRangeFromSelection

There is also this related command:

Fold All Regions Except Selected
editor.foldAllExcept
Mark
  • 143,421
  • 24
  • 428
  • 436