Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a common region comment for both VS Code and IntelliJ IDEA

In VS Code we have to use following syntax to section out a region:

// #region 
content relevant to this region
// #endregion

But for IntelliJ it's as follows:

// region
content relevant to this region
// endregion

(Above code snippets are from JavaScript)

Anyone knows a common pattern to use which will support in both IDEs ?

like image 903
thinuwan Avatar asked Sep 12 '25 23:09

thinuwan


1 Answers

Apparently //#region and //#endregion work for both? Not sure if that applies to all languages. I assume you're working with JS/TS?

If that ends up giving you lint warnings for some linter, that might be solvable. Ex. For ESLint, see ESLint: how to spaced-comment exceptions on VSCode folding regions comments.

As for finding out what region folding comments work in VS Code, that can depend on what language support extensions you are using, and what exactly they implement. VS Code comes with some builtin, but language extensions can add their own (see FoldingRangeProvider).

like image 92
starball Avatar answered Sep 15 '25 13:09

starball