Skip to content

PowerShell code folding is not working for here strings #177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
imacks opened this issue May 13, 2016 · 24 comments
Closed

PowerShell code folding is not working for here strings #177

imacks opened this issue May 13, 2016 · 24 comments
Labels
Area-UI Issue-Enhancement A feature request (enhancement).

Comments

@imacks
Copy link

imacks commented May 13, 2016

still no code folding if using here strings :(
or #region for that matter.

function New-VSCodeCannotFold {

$I = @'
cannot fold
'@    

#region Can't fold a region

$b = 'foobar'
$c = 'foobar'
$d = 'foobar'

#endregion

}
@rkeithhill
Copy link
Contributor

This is a VSCode issue at this point in time. It supplies the folding based purely on indentation level. It does not allow the extension/language to participate in determining what folds. See microsoft/vscode#3422

@daviwil
Copy link
Contributor

daviwil commented May 13, 2016

Yep, unfortunately we can't help with that at the moment. I'm hoping that the code folding feature is going to be improved in the near future.

@daviwil daviwil changed the title still no here string folding PowerShell code folding is insufficient in some ways May 15, 2016
@daviwil
Copy link
Contributor

daviwil commented May 15, 2016

I'm going to re-open this issue as a way to track the common request that code folding be improved. This is an issue that still needs to be fixed by the VS Code team.

@johlju
Copy link

johlju commented Jul 21, 2016

Information: #region does work inside functions which the first 4 spaces. But not outside a function, or after 5 spaces and more. See more in closed issue #129

@robplank
Copy link

robplank commented Aug 9, 2016

Adding a comment block inside of a function also impact the folding of code

and
<#
Comment
#>
image

@rkeithhill
Copy link
Contributor

Yup, same issue. VSCode folds based on indentation level. The language extension does not get a chance to participate in code folding to provide more semantics-aware folding. Too bad. I hope VSCode can add this before too long.

@adbertram
Copy link
Contributor

I would love to be able to fold at #region as well.

@daviwil daviwil added the Bug: VS Code Bugs in VS Code itself. label Sep 8, 2016
@sgtoj
Copy link

sgtoj commented Sep 21, 2016

Does a new GitHub issue need to be created for #region/#endregion support?

edit: Nevermind? If I read this correctly, the issue is a limitation with VS Code's code folding feature?

@daviwil
Copy link
Contributor

daviwil commented Sep 21, 2016

@sgtoj yep, #region/#endregion support falls under this category as well.

@LeeDailey
Copy link

howdy y'all,

is there a VSCode issue for this? if so, would some kind person please point me to it?

take care,
lee

@rkeithhill
Copy link
Contributor

@LeeDailey See microsoft/vscode#3422

@LeeDailey
Copy link

howdy rkeithhill,

thank you! [grin] my search talent was not up to snuff ...

take care,
lee

@TylerLeonhardt
Copy link
Member

VSCode team added region folding support! Please open a new issue if you see any problems.

@rkeithhill
Copy link
Contributor

While region support has been added, here strings in PowerShell are still a problem.

@TylerLeonhardt
Copy link
Member

TylerLeonhardt commented Dec 6, 2017

Good point - I missed that part of the issue. I'll reopen this and rename it to specify here strings

@TylerLeonhardt TylerLeonhardt reopened this Dec 6, 2017
@TylerLeonhardt TylerLeonhardt changed the title PowerShell code folding is insufficient in some ways PowerShell code folding is not working for here strings Dec 6, 2017
@TylerLeonhardt TylerLeonhardt added Issue-Enhancement A feature request (enhancement). and removed Resolution-Fixed labels Dec 6, 2017
@fbehrens
Copy link

fbehrens commented Dec 16, 2017

Hi, just want to drop an idea here about the powershell here strings. Would it be better to add an indenting feature in powershell, which removes the leading (indenting) whitespace block.

There they are already a pain in the ass, when you are refactoring a block of code. iE put an IF around it, you ident the block. The here-string breaks this refactoring.

Don't have any idea about the syntax, but this example shows the concept:

if ($true){
    write-Host head
    write-host @@"
        Line 1
          Line 2
    "@@ 
}
# output
# head
# Line 1
#   Line 2

@TylerLeonhardt TylerLeonhardt added Area-UI and removed Bug: VS Code Bugs in VS Code itself. labels Feb 2, 2018
@mpearon
Copy link

mpearon commented Mar 12, 2018

So, according to this, the VSCode Team has implemented an API for code folding. I'm sure this is on the implementation radar somewhere, @rkeithhill ?

@rkeithhill
Copy link
Contributor

@mpearon Thanks for the pointer. We'll definitely be looking at this but keep in mind that it is a "proposed" API with limitations i.e.:

you cannot publish an extension to the Marketplace that uses the enableProposedApi attribute.

So we will be tracking development of this API but we will need to wait until it's done before rolling it out with the PowerShell extension.

@mpearon
Copy link

mpearon commented Mar 13, 2018

@rkeithhill - I completely understand! :) I'm just glad you guys are aware of it. I'm excited to see the magic happen!

@fromthewoods
Copy link

Looks like it's official! https://code.visualstudio.com/updates/v1_23#_folding-provider-api

@mpearon
Copy link

mpearon commented May 14, 2018

Since there is an official provider now, has this become an active pursuit, @rkeithhill?

@TylerLeonhardt
Copy link
Member

@mpearson It can be pursued with enough 👍's!

Don't expect it right away because everyone has been tied down with other things:

I'm fighting performance issues with intellisense, Rob's but dealing with some PowerShell/PowerShell tasks.

Keith may be able to pick this up. He'll have to chime in on that.

This is an open source project so feel free to take a crack at it, otherwise, we'll get to it as soon as we can. 😀 There's lots to do!

@mpearon
Copy link

mpearon commented May 15, 2018

@tylerl0706 I completely understand! I really wish I was to the point where I could legitimately contribute, because this is such a cool project. I'll working on getting there, but I'm still very fresh.
I appreciate all that you guys are doing!

@TylerLeonhardt
Copy link
Member

Going to dupe this to #1276 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UI Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests