Vscode-powershell: Provide support for Region tag

Created on 29 Mar 2016  路  14Comments  路  Source: PowerShell/vscode-powershell

Apologies if this is already in here somewhere, I looked through the open and closed issues and didn't see it. When I view a PowerShell script or module in VS Code, I can see that the #region and #endregion tags show up in green like proper comments, but don't provide a way to collapse the relevant lines like the PowerShell ISE provides. It was suggested in the PowerShell FB group to get this on the list for the PowerShell extension to VS Code, and I'll let the folks there know about it in case further discussion is needed.

All 14 comments

Hey @nfields03, this is currently an issue with how VS Code implements folding support. They're aware of the issue and @rkeithhill has called out the PowerShell case specifically here:

https://github.com/Microsoft/vscode/issues/3422#issuecomment-189576426

It seems the latest VS Code Insiders release has not fixed this issue yet so hopefully they'll get to it in the next month or two. I'll close this issue for now since there's nothing we can do for it (yet) in our extension.

Thanks for the clarification David, cheers!

as the current insiders build on 20160721, this is still not working, and it seems both issues are closed.

I believe we're still waiting on the main VS Code application to support language aware folding; once that gets into the main program I suspect PowerShell folding/regions will happen in short order...

Region tag works only if the tag is written within the first 4 spaces.

it right at the start, no spaces:
untitled

notice no plus/minus at he region tag at the top.

and a side note, that at string of an sql query probably shouldn't be folding just because there are tabs.

Ok, so it seems #region must be within a function as well.
2016-07-21 2

I'm glad you figured that out, but that seems like its incorrect right? I mean, I'm more likely to use this function in scripts rather then inside functions.

Yes, I think it need to (and should) work anywhere you put it, as long as it's the only thing on that row.
I pointed out this before as well, in another issue, which also is closed, In that issue @daviwil said we need to wait for VS.Code to get the functionality. In this issue he says they are working on it. They probably has more pressing matters, and hasn't gotten that far yet. :)

I wonder if they're using the syntax highlighter scopes to determine where to fold... The latest VS Code update contains a refactored PowerShell syntax highlighting file so maybe that accounts for the change in behavior? I'll have to look into it again when I get more time.

Any news on this?

Not at the moment, we are still waiting for support for syntax aware folding to be added in VS Code.

That'll be great!

Hi All

Is there any update on this request?

Was this page helpful?
0 / 5 - 0 ratings