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

Code Folding not working with PoshBot code #811

Closed
glennsarti opened this issue Dec 8, 2018 · 1 comment
Closed

Code Folding not working with PoshBot code #811

glennsarti opened this issue Dec 8, 2018 · 1 comment

Comments

@glennsarti
Copy link
Contributor

Originally from PowerShell/vscode-powershell#1631


System Details

System Details Output

### VSCode version: 1.29.1 bc24f98b5f70467bc689abf41cc5550ca637088e x64

### VSCode extensions:
CoenraadS.bracket-pair-colorizer@1.0.61
DavidAnson.vscode-markdownlint@0.21.0
eamodio.gitlens@9.0.2
EditorConfig.EditorConfig@0.12.5
eg2.tslint@1.0.40
Equinusocio.vsc-material-theme@2.6.2
kisstkondoros.vscode-codemetrics@1.17.4
ms-vscode.csharp@1.17.1
ms-vscode.PowerShell@1.10.0
wesbos.theme-cobalt2@2.1.6


### PSES version: 1.10.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      5.1.17763.134
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.17763.134
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Issue Description

I am experiencing a problem with code folding. The SendMessage functions within the PoshBot Backends for slack and teams both fold rather weirdly.

Raw files:
https://raw.githubusercontent.com/poshbotio/PoshBot/master/PoshBot/Implementations/Teams/TeamsBackend.ps1
https://raw.githubusercontent.com/poshbotio/PoshBot/master/PoshBot/Implementations/Slack/SlackBackend.ps1

Expected Behaviour

It should fold the entire function.

Actual Behaviour

It folds parts of the function.

@glennsarti
Copy link
Contributor Author

Copied issue here for a legit issue number

glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 8, 2018
Previously the token matching was broken;
```
foreach ($1 in $2) {     <----- STARTS MATCH HERE (1)

    $x = @{  <-----   STARTS MATCH HERE (2)
        'abc' = 'def'
    }        <----- ENDS   MATCH HERE (1) (2)
}
```

This was caused by two or more different token pairs sharing the same end token.
This commit modifies the token pair matching to take an array of Start Tokens
instead of a single.  This has the added benefit of performance increase too.

This commit also adds tests for this scenario.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 8, 2018
…lder

Previously the code folder was not aware of unoppinionated variable name
assignments.  This commit adds detection and an appropriate test.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 8, 2018
This commit adds a splat command to the folding scenario to ensure that the
folder is not confused by the (at) character for splatting.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 12, 2018
Previously the code folder was not aware of unopinionated variable name
assignments.  This commit adds detection and an appropriate test.
glennsarti added a commit to glennsarti/PowerShellEditorServices that referenced this issue Dec 12, 2018
This commit adds a splat command to the folding scenario to ensure that the
folder is not confused by the (at) character for splatting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant