Vscode-powershell: region/endregion tags do not fold like they do in the PowerShell ISE

Created on 30 Mar 2017  路  8Comments  路  Source: PowerShell/vscode-powershell

System Details

  • Operating system name and version: MacOS 10.12.3
  • VS Code version: 1.10.2
  • PowerShell extension version: 0.11
  • Output from $PSVersionTable:
    PSVersion 6.0.0-alpha
    PSEdition Core
    PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
    BuildVersion 3.0.0.0
    GitCommitId v6.0.0-alpha.14
    CLRVersion
    WSManStackVersion 3.0
    PSRemotingProtocolVersion 2.3
    SerializationVersion 1.1.0.1
Copy / paste the below commands into the PowerShell Integrated Terminal, and paste the output here

.10.2
8076a19fdcab7e1fc1707952d652f0bb6c6db331
PS /Users/dan/Documents/projects/test> $pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
0      11     0      0

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]



Issue Description

I am experiencing a problem with...

In Powershell ISE, when you use the tag #region and #endregion, the editor automatically places a + next to the region tag to allow you to collapse that section. In VSCode this doesn't seem to be a feature.

I use this feature constantly to organize my functions scripts etc.

Attached Logs

Follow the instructions in the README
about capturing and sending logs.

Issue-Enhancement vscode-bug

Most helpful comment

Ahhh yep, code formatting "fixes" it ;) Now that the extension is at 1.0 I'm going to start investigating how to get this issue fixed in VS Code.

All 8 comments

Yep, @dotps1 is correct, we are waiting for the VS Code team to implement proper folding based on language syntax. I'm going to keep the bug open this time so that new users can find it easily.

@daviwil do you have any insight on when the VSCode team might address this?

This seems to work as expected if the #region and #endregion tags are not indented, however in most cases auto-format kills this. I'm not sure if that helps at all, but I figured it's worth pointing out. Currently on version 1.0.0 of this extension and version 1.12.1 of vs code.

Ahhh yep, code formatting "fixes" it ;) Now that the extension is at 1.0 I'm going to start investigating how to get this issue fixed in VS Code.

I don't see the behavior working correctly, with VS Code version 1.12.2 and the extension at 1.0.0. I have a script that uses nested regions (One for folding all functions, then inside that, one for functions I've gotten from the Internet, one region for "database" functions, one for "log parsing" functions, and one for "Data Processing" functions. This makes it so that I can fold all the functions, or most of the functions and just get to what I'm interested in.

The folding works perfectly in the ISE, but in VS Code, the only one that folds is the "Internet functions" part, which is the first "subregion".

All my #region and #endregion comments are not indented at all.

Since this is my first post, please let me know what will help best? Do you want the script? Screenshots? Is this the right place? VSCode looks like it could be really cool, and this extension is pretty awesome, so I want to start using it, but I use regions extensively, and this would be really nice.

@dan185818 this is an ongoing limitation of VS Code, there is still no fix on the radar yet.

VSCode added region support and this is fixed! Please open a new issue if you see any problems.

Was this page helpful?
0 / 5 - 0 ratings