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.

Support All Native Code Folding Commands

See original GitHub issue

Visual 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:

  1. Add the example PowerShell function below to a document in VS Code.
  2. Open the Command Palette
  3. Attempt to run the Fold All Regions or Fold All Block Comments commands.
  4. 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
TylerLeonhardtcommented, May 16, 2020

This has been merged in. The next version of the PowerShell Preview extension should have this change.

0reactions
TylerLeonhardtcommented, May 16, 2020

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to enable and use code folding in Vim?
That's it. The most useful commands for working with folds are: z o opens a fold at the cursor. z Shift + o...
Read more >
Code folding - Wikipedia
Code or text folding, or less commonly holophrasting, is a feature of some graphical user interfaces that allows the user to selectively hide...
Read more >
Code Folding and Sections in the RStudio IDE - Posit Support
Menu Commands and Shortcuts · Edit -> Folding: Collapse — Alt+L Expand — Shift+Alt+L Collapse All — Alt+O Expand All — Shift+Alt+O ·...
Read more >
Code Folding - Developer Help
How to configure code folding options ; 1. Go to the menu Tools ▻ Options ; 2. In the window that opens, select...
Read more >
How do I collapse sections of code in Visual Studio Code for ...
Shift + Click on the folding indicator first only folds the inner ranges. Shift + Click again (when all inner ranges are already...
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