vscode-powershell: PowerShell Extension 1.8.1 breaks editor folding on region tags

System Details

  • Operating system name and version: Windows 10.1803.17134.137
  • VSCode Version: 1.25.0
  • PowerShell extension version: 1.8.1
  • Output from $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 cdsama.tortoise-svn-for-vscode@0.1.1 dakara.transformer@1.6.0 emmanuelbeziat.vscode-great-icons@2.1.36 GrapeCity.gc-excelviewer@2.1.24 ilich8086.coldfusion@1.0.1 mechatroner.rainbow-csv@0.4.2 ms-vscode.csharp@1.15.2 ms-vscode.PowerShell@1.8.1 PKief.material-icon-theme@3.5.1 schneiderpat.aspnet-helper@0.6.4 tuxtina.json2yaml@0.2.0

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:

  1. Install vscode
  2. Open a powershell script file containing working region and endregion tags
  3. Observe that the editor folding works
  4. Install Powershell Extension (ms-vscode.powershell) version 1.8.1
  5. Relaunch vscode
  6. Observe that editor folding is not working

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 3
  • Comments: 22 (8 by maintainers)

Commits related to this issue

Most upvoted comments

@stukey Thanks. That makes it make easier to track down what’s going on. I’ve repro’d locally and working on a fix.

I am experiencing this issue too.

Syntax folding enabled (powershell.codeFolding.enable = true):

9d4bfac6-4166-4e1a-a52e-dc721fe22e5a

Syntax folding disabled (powershell.codeFolding.enable = false):

6f0d0f44-7ec9-4ffd-a2b1-f42fbec9f287

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).

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; https://github.com/Microsoft/vscode/blob/master/extensions/powershell/language-configuration.json#L26-L31

The syntax folder uses this; https://github.com/PowerShell/vscode-powershell/blob/master/src/features/Folding.ts#L425-L426

One difference I see is casing.

However without the source document debugging/reproing this issue is almost impossible.

@msm-fc

  1. Can you please provide the document you used when you saw the issue
  2. Preferably adds some screenshots with the syntax-folding enabled and disabled (requires a VSCode reload to take effect)

VSCode setting; "powershell.codeFolding.enable": "false",