question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

JavaScript/TypeScript region folding with //region does not work

See original GitHub issue
  • VSCode Version: 1.30.2
  • OS Version: Linux x64 4.20.0-arch1-1-ARCH

Steps to Reproduce:

  1. Use //region and //endregion in JavaScript and/or TypeScript files to create folding regions.

Does this issue occur when all extensions are disabled?: Yes

The release notes for 1.17 mention that support was added for folding regions. For JavaScript/TypeScript, both //#region //#endregion and //region //endregion were added. However only //#region //#endregion seem to work. //region //endregion do not work. This is annoying because some projects I work on use this syntax throughout all the code.

vscode_folding_regions

Code snippet

//region region
//endregion

// region region with space
// endregion

//#region #region
//#endregion

// #region #region with space
// #endregion

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:12
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
mjbvzcommented, Jan 11, 2019

Moved upstream to TypeScript for more feedback since we now use language aware folding. We should wait for more feedback to see if //region is used enough vs to //#region to warrant support

1reaction
Popeye4242commented, Jan 5, 2021

@mjbvz I just want to mention that in WebStorm // region is supported by default and // #region might be supported too as you can define custom region expressions there. I think VS Code should allow that too. That way region expression from other editors can be supported too without additional work.

Read more comments on GitHub >

github_iconTop Results From Across the Web

JavaScript/TypeScript region folding with //region does not work
Use //region and //endregion in JavaScript and/or TypeScript files to create folding regions. Does this issue occur when all extensions are ...
Read more >
Regions in TypeScript [closed] - Stack Overflow
js, while retaining intellisense, and then compiling it into one js file for your website. Regions aren't that bad in certain contexts. You...
Read more >
region folding for VS Code - Visual Studio Marketplace
This extension enhances the default code folding abilities of Visual Studio Code editor. Regions of code that you'd like to be folded can...
Read more >
Collapse and expand regions of code - Visual Studio (Windows)
Learn how you can use the expand and collapse commands to work in outline mode in Visual Studio.
Read more >
Code Folding | IntelliJ IDEA Documentation - JetBrains
Now, when you select the Custom folding regions option, IntelliJ IDEA will fold such regions when you open your file in the editor....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found