Vscode-powershell: Collapsible/expandable Functions, Regions, Comment blocks, and Comment based help blocks

Created on 28 May 2018  路  17Comments  路  Source: PowerShell/vscode-powershell

Summary of the new feature

As a user I want to be able to collapse and expand Functions, Regions, Comment blocks, and Comment based help blocks. This helps me goto the section/region of code that I want to work on without having to scroll through thousands of lines of code to find the section I need.

I really like all the features in VS code however without this feature it is a deal breaker for me, I would rather use PS ISE or VS Community as they have this feature and makes my work much easier. I don't like having to scroll thru thousands of lines of code to find the section I need. I designed my tool with regions but I can't use them with VS code,

Issue-Enhancement

Most helpful comment

@glennsarti It's working beautifully! A bit of an oddity, though - possibly expected in its current state.
HereStrings are not breaking parent or adjacent folds, but the HereStrings themselves are not folding.
herestring

All 17 comments

I believe VSCode recently introduced various folding features:

There are a number of similar user asks here:

There is currently some other work prioritised, but it looks like there are a few related pieces of functionality here that we should look into soon.

Actually this has the most info, so I'll make this the main one.

@rjmholt I have looked at the links you posted however those shortcuts don't work with powershell which is my primary language I should have been a little more clear. I'm looking for the equivalent shortcut to "fold" as you call it, all regions in my code like in powershell ISE it's Ctrl-M.

@Shane091490 You are correct. This is work we need to do to support this Folding Provider. We'll get to this as soon as we can!

@Shane091490 FYI, you can already fold/unfold all regions in VSCode using Ctrl+K Ctrl+8 and Ctrl+K Ctrl+9.

@tylerl0706 I've started a WIP PR for adding this. Will work on it when I can.

Exciting!! We really need this 馃帀 thank you so much

@tylerl0706 No longer WIP :-)

@glennsarti Just catching up here - but does this mean there is a PowerShell folding provider available now?

@mpearon The PR is close to being merged: https://github.com/PowerShell/vscode-powershell/pull/1355

@glennsarti I noticed in the docs here that this is hidden behind a feature flag. Is this something we can enable in its beta form by adding a string to the array?

@mpearon. Not yet. You will need to wait for the next release or wait for #1355 to be merged and then grab a CI build from AppVeyor.

Then you'll be able to add the feature flag and have this feature.

@mpearon If you _really_ _really_ want to try it, you can get an "in-progress" build e.g. https://ci.appveyor.com/project/PowerShell/vscode-powershell-cs82i/build/1.7.0-insiders-148/artifacts

And yes, you'll need to add the appropriate feature flag (syntax-folding) to your workspace settings.

@glennsarti Awesome! Grabbing the build now. :)

@glennsarti It's working beautifully! A bit of an oddity, though - possibly expected in its current state.
HereStrings are not breaking parent or adjacent folds, but the HereStrings themselves are not folding.
herestring

@mpearon Huh... Odd..

I've added the comments to the PR. Probably best to raise issues for PRs that are yet-to-be-merged in the PR itself.

Was this page helpful?
0 / 5 - 0 ratings