Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 3
    // region and // endregion are not working with VS Code version 1.22 (haven't tested versions below or above that though). But // #region and // #endregion works (note the '#' and space in both). This way ESLint (if you are using) won't show error if spaced-comment rule is on (i.e. not set to 'off' or 0). Commented Apr 11, 2018 at 12:55
  • 2
    In CSS, it's actually /* #region Foo Bar */ and /* #endregion */ Commented May 22, 2018 at 1:18
  • 1
    @ozanmuyes it depends on the file type (language). //region and //endregion are for JavaScript. Commented Jun 4, 2019 at 7:36
  • Works nicely in Docker .yaml files as well, if you install Microsoft's docker ext: marketplace.visualstudio.com/… Commented Oct 10, 2019 at 1:40
  • v1.41 : I tried XML and it worked! <!-- #region --> elements <!-- #endregion -->. It displays the text following the #region on the folded section. It properly folds from the current #region to the corresponding #endregion, even if there are others nested - just like parentheses in any equation. It remembers the fold setting for nested regions. Ctrl+k+Ctrl+[ and Ctrl+k+Ctrl+] close/open the folds correctly at the cursor. (which seems a little backwards to me, but whatevah) Great stuff! Commented Jan 12, 2020 at 21:28