Support All Native Code Folding Commands
See original GitHub issueVisual Studio Code offers several useful code folding commands that currently do nothing when editing PowerShell files: Fold All Regions, Unfold All Regions, Fold All Block Comments, and Unfold All Block Comments. I request you add support support for these commands.
Both would be quite useful to me. Being able to easily fold just #region sections would prevent overfolding when dealing with #regions nested in try/catch/finally, if, or switch blocks alongside code not contained in a #region. Similarly, being able to fold just block comments would greatly ease editing files that contain numerous functions with long and detailed comment-based-help sections (I have some scripts that contain several advanced functions, each with multi-page comment-based-help blocks).
You can replicate this issue via the following:
- Add the example PowerShell function below to a document in VS Code.
- Open the Command Palette
- Attempt to run the Fold All Regions or Fold All Block Comments commands.
- Observe that no folding occurred.
<#
.SYNOPSIS
Short description
.DESCRIPTION
Long description
.PARAMETER a
Parameter description
.PARAMETER b
Parameter description
.EXAMPLE
An example
.NOTES
General notes
#>
function test-function ($a, $b) {
#region handle a
if($a -lt $b) {$a++}
#endregion handle a
#region handle b
if($b -gt 10) {$b--}
#endregion handle b
return $a+$b
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:6 (5 by maintainers)
Top GitHub Comments
This has been merged in. The next version of the PowerShell Preview extension should have this change.
The issue was in the library we depend on. I have a PR out now: https://github.com/OmniSharp/csharp-language-server-protocol/pull/241