-
Notifications
You must be signed in to change notification settings - Fork 511
PowerShell Extension 1.8.1 breaks editor folding on region tags #1428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for opening an issue @msm-fc! We think 1.8.0 broke this as well. VSCode seems to implement its own |
The new syntax folder is all or nothing, i.e. when active, only the folding ranges supplied will be used. None of the vscode default ones will be used. The vscode region folding is defined here; The syntax folder uses this; One difference I see is casing. However without the source document debugging/reproing this issue is almost impossible.
VSCode setting; |
Thanks @glennsarti! |
I am experiencing this issue too. Syntax folding enabled (powershell.codeFolding.enable = true): Syntax folding disabled (powershell.codeFolding.enable = false): I noticed the problem with version 1.8.0 of the PowerShell extension too. Also version 1.8.0 or 1.8.1 appears to have made Region Folding case-sensitive again. So even with ‘powershell.codeFolding.enable’ set to false, #Region #EndRegion sections are not folded but #region #endregion sections are folded. Prior to 1.8.0 I noticed that Region Folding became non case-sensitive (which was better). |
@stukey Thanks. That makes it make easier to track down what's going on. I've repro'd locally and working on a fix. |
@glennsarti Great thanks Glenn. |
… whitespace Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to use a similar regex to that of the VS Code default, defined in microsoft/vscode@64186b0 Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
So PR #1430 is up to fix the region case sensitivity problem. The PowerShell region folding doesn't actually come from the PowerShell extension, it's embedded in VSCode by default, which is why the behaviour can seem odd i.e. Code Folding Disabled, with VSCode 1.23 and PowerShell Extension 1.8.1 will have case sensitive region folding :-) Interestingly, VSCode only fixed that in 1.24.0 which is probably why I missed it orginally (microsoft/vscode@64186b0) |
…itespace correctly Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to use a similar regex to that of the VS Code default, defined in microsoft/vscode@64186b0 Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
@stukey If you know how to use one-off extension builds, https://ci.appveyor.com/project/PowerShell/vscode-powershell-cs82i/build/1.8.1-insiders-236/artifacts has the VSIX file for that PR |
Thanks @glennsarti I don’t know how to do that so I will wait for the release version. Just so I’m clear do I still have to disable syntax folding in order for region folding to work properly in ps1 scripts (as it did before 1.8.0)? |
Yes. Once the new version is released, you can re-enable syntax folding. |
@glennsarti I pulled down the VSIX file and can confirm that region folding is working again under that artifact. |
Excellent!! Thankyou! |
When will this be merged into a release version? I have no idea how that works... |
@rjmholt and @rkeithhill will be able to answer that |
@stukey there is a menu option to "install from vsix file" that lets you manually add the extension: Just download the file and browse to it when prompted. There is another prompt that you have an "earlier version" of the extension but just let it overwrite that version. |
Thanks @wsmelton ! |
Also @stukey if you have the VSIX file downloaded, you can install it in the CLI like this:
|
…itespace correctly Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to use a similar regex to that of the VS Code default, defined in microsoft/vscode@64186b0 Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
…itespace correctly Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to be case insensitive, similar to that defined in microsoft/vscode@64186b0 Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
…hitespace Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to be case insensitive, similar to that defined in microsoft/vscode@64186b0 This commit adds has strict whitespace rules for the region/endregion keyword which means only `#region` will match whereas `# region` will not. Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
@glennsarti OK, thanks for testing. |
…1430) Previously the code folding feature would fail to find region blocks starting with `Region` or ending with `EndRegion`. This was due to the regex only looking for lower case. This commit updates the start and end region detection to be case insensitive, similar to that defined in microsoft/vscode@64186b0 This commit adds has strict whitespace rules for the region/endregion keyword which means only `#region` will match whereas `# region` will not. Previously the code folding had trouble detecting the beginning of comment blocks and regions which were not indented. This was due to the empty line regex expecting at least one whitespace character to be considered "an empty line". This commit modifies the empty line regex to also allow an empty string which is indeed, an empty line.
@glennsarti using [email protected] with vscode 1.25.1, the issue appears resolved. Thanks!! I'm using this test code to verify: |
The release went out this morning with a fix for this in it |
System Details
$PSVersionTable
:Name Value
PSVersion 5.1.17134.137
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.137
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable
1.25.0
0f080e5267e829de46638128001aeb7ca2d6d50e
x64
Major Minor Build Revision
1 8 1 0
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
Key : PSVersion
Value : 5.1.17134.137
Name : PSVersion
Key : PSEdition
Value : Desktop
Name : PSEdition
Key : PSCompatibleVersions
Value : {1.0, 2.0, 3.0, 4.0...}
Name : PSCompatibleVersions
Key : BuildVersion
Value : 10.0.17134.137
Name : BuildVersion
Key : CLRVersion
Value : 4.0.30319.42000
Name : CLRVersion
Key : WSManStackVersion
Value : 3.0
Name : WSManStackVersion
Key : PSRemotingProtocolVersion
Value : 2.3
Name : PSRemotingProtocolVersion
Key : SerializationVersion
Value : 1.1.0.1
Name : SerializationVersion
Issue Description
Searched for existing issues, didn't find anything.
Others in the chat room also confirmed
Reproduced with latest Insiders Build of vscode.
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: