Skip to content
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

Unfolding not possible #1523

Closed
aeschli opened this issue Sep 11, 2018 · 9 comments · Fixed by #1525
Closed

Unfolding not possible #1523

aeschli opened this issue Sep 11, 2018 · 9 comments · Fixed by #1525
Labels

Comments

@aeschli
Copy link
Contributor

aeschli commented Sep 11, 2018

From @DarkLite1 on September 11, 2018 6:53

Consider the following PowerShell file:

Test.ps1

        $ImportedMatrix = @(Get-ChildItem -Path ImportDir:\* -Include *.xlsx -File).Where({
            $_.FullName -ne $DefaultsItem.FullName}).ForEach({
            Try { 
                $Obj = [PSCustomObject]@{
                    File = @{
                        Item = $_
                        SaveFullName = $_.FullName
                        ExcelInfo = $null
                        LogFolder = $null
                        Check = @()
                    }
                    Settings = @()
                    Permissions = @{ 
                        Import = @()
                        Check = @()
                    }
                }

                $Obj
            }
            Catch {
                Write-Warning $_
                Send-MailHC -To $ScriptAdmin -Subject FAILURE -Priority High -Message $_ -Header $ScriptName
                Write-EventLog @EventErrorParams -Message ($env:USERNAME + ' - ' + "FAILURE:`n`n- " + $_)
                Write-EventLog @EventEndParams; Exit 1
            }
        })
  1. Perform the action Fold all with the command palette
  2. Try to click the plus sign to unfold, notice that unfolding is not possible with the mouse.

image

Workarounds:

  1. Unfold all with the command palettte.
  2. Move the code $_.FullName -ne $DefaultsItem.FullName}).ForEach({ after the Where clause on the same line
Version: 1.28.0-insider (user setup)
Commit: 96854113091424c07b28ba84b82b75a88b8455cb
Date: 2018-09-10T05:18:57.119Z
Electron: 2.0.7
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64

Copied from original issue: microsoft/vscode#58414

@aeschli
Copy link
Contributor Author

aeschli commented Sep 11, 2018

It's a problem in the Powershell extension. It returns a range 1-2 which overlaps with the next range.
screenshot from 2018-09-11 16-04-24

@TylerLeonhardt
Copy link
Member

Thanks @aeschli and sorry @DarkLite1 for the running around. We'll look into this.

@TylerLeonhardt
Copy link
Member

I was able to repro this. cc'ing @glennsarti who worked on this feature :) I wonder if this is related to the fact that there is a ({ next to each other - followed by a }) further down.

@glennsarti
Copy link
Contributor

Ahh ok...so overlapping ranges are a problem. Previous testing showed this wasn't the case. Okay...time to trim the ranges then!

@glennsarti
Copy link
Contributor

Repro'd locally myself too ... working on fix.

@TylerLeonhardt
Copy link
Member

@glennsarti thanks for jumping on this! You're the best 👍

glennsarti added a commit to glennsarti/vscode-powershell that referenced this issue Sep 12, 2018
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit adds a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
glennsarti added a commit to glennsarti/vscode-powershell that referenced this issue Sep 12, 2018
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit adds a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
@glennsarti
Copy link
Contributor

@tylerl0706 Fix is up in PR 1525. Just waiting on green CI.

@glennsarti
Copy link
Contributor

@DarkLite1 Thanks for the issue report and providing an example script. Makes debugging SO much easier and faster bugfix turnaround!

glennsarti added a commit to glennsarti/vscode-powershell that referenced this issue Sep 12, 2018
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit uses a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
@DarkLite1
Copy link

You're welcome and thanks for the fast fix 👍 I just hope #1517 gets some TLC too, as this is a very very annoying one when working with HTML. But that's another topic.

Thanks guys, really appreciate your help.

glennsarti added a commit to glennsarti/vscode-powershell that referenced this issue Sep 17, 2018
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit uses a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
TylerLeonhardt pushed a commit that referenced this issue Sep 17, 2018
Previously the syntax folder returned an ordered list of folding ranges which
VS Code would "ignore" overlapping or duplicate ranges.  However on manual
testing, it showed that duplicate region did exist and could be folded/unfolded
using the "Fold All" and "Unfold All" commands, but could NOT be manipulated
manually in the editor using the +/- indicator.

This commit uses a filter which removes any duplicate or overlapping regions
which is easily detected via similar region start lines.  This commit also adds
a test for this scenario.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants