How do I fold or collapse an arbitrary selection of code in Visual Studio Code? Is this feature supported?
Of course Sublime and Atom know this for ages.
How do I fold or collapse an arbitrary selection of code in Visual Studio Code? Is this feature supported?
Of course Sublime and Atom know this for ages.
Still not supported. The proposed solutions here are not for the original question, which is to highlight any code and fold it--not to fold formal code blocks.
v1.22 (released April, 2018) just implemented syntax-aware code folding for a few languages. See release note: code folding. It is still experimental but is enabled by default for javascript.
Ctrl-Shift-[ and Ctrl-Shift-]
VS Code now allows arbitrary blocks of code to be marked with // #region and // #endregion to make them collapsible.
// #region Hello
console.log("Hello world")
// #endregion