Open corbob opened 2 years ago
That's strange, I'm not reproing with the Preview and pwsh 7.2.3 on macOS...
What's the output of Get-Module Pester
in the PSIC for you? I have version 5.2.2.
I have version 5.3.1... Interestingly it's still reproducing for me even with pester not imported into PSIC.
It also reproduces on both stable and preview extensions.
It also reproduces on both stable and preview extensions.
Something weird is going on for sure.
Try disabling TylerLeonhardt.vscode-inline-values-powershell
? IDK.
Well FWIW I updated to 5.3.3 and it still doesn't repro for me. Trying on Windows now, who knows.
Nope, not there either.
Hey! It repro'd with the installed PowerShell Preview, but not when I was loading under a dev environment. Interesting.
I'm not able to repro it on Windows with either version of Code, and on my Mac it's not reproducing on stable Code. It's looking like it's a stray setting somewhere because I just installed all the same extensions onto my Windows system and the issue doesn't repro like that either.
Given that it's only one of the 4 code environments on my system, and you can't reproduce it, I'll go ahead and close this issue. If I happen to find what's causing it I'll reopen it.
I was going to close it since I can't repro it outside of my one install, but if you're able to repro then maybe it's worth keeping open?
Yeah leave it open...can you list all your extensions for me? Big difference with dev environment is that all other extensions are disabled. I don't believe that my settings are changed though, and I tried a dev build of an older version of the extension so as to rule that out too.
> code --list-extensions
alefragnani.Bookmarks
bungcip.better-toml
DavidAnson.vscode-markdownlint
eamodio.gitlens
EditorConfig.EditorConfig
fabiospampinato.vscode-highlight
GitHub.copilot
GitHub.vscode-pull-request-github
josefpihrt-vscode.roslynator
ms-azure-devops.azure-pipelines
ms-dotnettools.csharp
ms-python.python
ms-python.vscode-pylance
ms-vscode.azure-account
ms-vscode.hexeditor
ms-vscode.powershell-preview
ms-vscode.vscode-typescript-tslint-plugin
pspester.pester-test
qcz.text-power-tools
redhat.vscode-xml
richie5um2.vscode-sort-json
rusnason
74th.monokai-charcoal-high-contrast@3.4.0
bungcip.better-toml@0.3.2
cake-build.cake-vscode@2.0.0
DavidAnson.vscode-markdownlint@0.47.0
eamodio.gitlens@12.0.6
EditorConfig.EditorConfig@0.16.4
esbenp.prettier-vscode@9.5.0
felipecaputo.git-project-manager@1.8.2
GitHub.github-vscode-theme@6.0.0
GitHub.vscode-pull-request-github@0.40.0
GrapeCity.gc-excelviewer@4.2.54
johnpapa.vscode-peacock@4.0.1
mhutchie.git-graph@1.30.0
ms-dotnettools.csharp@1.24.4
ms-dotnettools.dotnet-interactive-vscode@1.0.3227011
ms-toolsai.jupyter@2022.3.1000901801
ms-toolsai.jupyter-keymap@1.0.0
ms-toolsai.jupyter-renderers@1.0.6
ms-vscode-remote.remote-containers@0.233.0
ms-vscode.hexeditor@1.9.6
ms-vscode.powershell@2021.12.0
ms-vscode.powershell-preview@2022.4.3
ms-vscode.vscode-typescript-tslint-plugin@1.3.4
rebornix.ruby@0.28.1
redhat.vscode-yaml@1.7.0
shardulm94.trailing-spaces@0.3.1
shd101wyy.markdown-preview-enhanced@0.6.2
sinedied.vscode-windows-xp-theme@0.1.0
tomphilbin.gruvbox-themes@1.0.0
TylerLeonhardt.vscode-inline-values-powershell@0.0.5
vsls-contrib.gistfs@0.4.1
wingrunr21.vscode-ruby@0.28.0
yzhang.markdown-all-in-one@3.4.3
I installed them all with the PowerShell:
@('74th.monokai-charcoal-high-contrast@3.4.0','bungcip.better-toml@0.3.2','cake-build.cake-vscode@2.0.0','DavidAnson.vscode-markdownlint@0.47.0','eamodio.gitlens@12.0.6','EditorConfig.EditorConfig@0.16.4','esbenp.prettier-vscode@9.5.0','felipecaputo.git-project-manager@1.8.2','GitHub.github-vscode-theme@6.0.0','GitHub.vscode-pull-request-github@0.40.0','GrapeCity.gc-excelviewer@4.2.54','johnpapa.vscode-peacock@4.0.1','mhutchie.git-graph@1.30.0','ms-dotnettools.csharp@1.24.4','ms-dotnettools.dotnet-interactive-vscode@1.0.3227011','ms-toolsai.jupyter@2022.3.1000901801','ms-toolsai.jupyter-keymap@1.0.0','ms-toolsai.jupyter-renderers@1.0.6','ms-vscode-remote.remote-containers@0.233.0','ms-vscode.hexeditor@1.9.6','ms-vscode.powershell@2021.12.0','ms-vscode.powershell-preview@2022.4.3','ms-vscode.vscode-typescript-tslint-plugin@1.3.4','rebornix.ruby@0.28.1','redhat.vscode-yaml@1.7.0','shardulm94.trailing-spaces@0.3.1','shd101wyy.markdown-preview-enhanced@0.6.2','sinedied.vscode-windows-xp-theme@0.1.0','tomphilbin.gruvbox-themes@1.0.0','TylerLeonhardt.vscode-inline-values-powershell@0.0.5','vsls-contrib.gistfs@0.4.1','wingrunr21.vscode-ruby@0.28.0','yzhang.markdown-all-in-one@3.4.3') | % {
code-insiders --install-extension ($_.Split('@')[0])
}
Here are our common extensions:
bungcip.better-toml@0.3.2
DavidAnson.vscode-markdownlint@0.47.0
eamodio.gitlens@12.0.6
EditorConfig.EditorConfig@0.16.4
GitHub.vscode-pull-request-github@0.40.0
ms-dotnettools.csharp@1.24.4
ms-vscode.hexeditor@1.9.6
ms-vscode.powershell-preview@2022.4.3
ms-vscode.vscode-typescript-tslint-plugin@1.3.4
Still repros with all those disabled...
@andschwa and @corbob If you have a working case and test case -- check the log file, it prints the parameters that are sent -- ( In the past, there was a case where it didn't match user's settings in the UI/Config file )
I wrote a script to detect the correct log and grep it
Mine was reproducing it on ms-vscode.powershell-2022.5.1
with code.cmd
. I was trying to determine which setting was the cause by manually toggling them on. It seemed almost like it wasn't always updating. I'd hit save in the json, then format. Unless the double-quotes to single quotes interacts with it?
This config breaks
> Find-VSCodeScriptAnalyzerConfig ms-vscode.powershell-2022.5.1
{
"IncludeRules": [
"PSPlaceCloseBrace",
"PSPlaceOpenBrace",
"PSUseConsistentWhitespace",
"PSUseConsistentIndentation",
"PSAlignAssignmentStatement",
"PSAvoidUsingDoubleQuotesForConstantString"
],
"Rules": {
"PSAvoidUsingCmdletAliases": {},
"PSUseConsistentWhitespace": {
"CheckInnerBrace": true,
"CheckPipe": true,
"CheckOpenParen": true,
"CheckSeparator": true,
"CheckParameter": true,
"Enable": true,
"CheckOpenBrace": true,
"CheckPipeForRedundantWhitespace": true,
"CheckOperator": true
},
"PSAlignAssignmentStatement": {
"Enable": true,
"CheckHashtable": true
},
"PSPlaceCloseBrace": {
"NewLineAfter": false,
"IgnoreOneLineBlock": false,
"Enable": true
},
"PSUseConsistentIndentation": {
"IndentationSize": 4,
"PipelineIndentation": 2,
"Kind": "space",
"Enable": true
},
"PSAvoidUsingDoubleQuotesForConstantString": {
"Enable": true
},
"PSUseCorrectCasing": {
"Enable": true
},
"PSPlaceOpenBrace": {
"NewLineAfter": true,
"Enable": true,
"IgnoreOneLineBlock": false,
"OnSameLine": true
}
}
}
Prerequisites
Summary
With the code (note two spaces between
)
and{
on line 7):When selecting to Format Document, results in:
When updating the code to include two spaces between
-ForEach
and@(
:It correctly formats:
And here's where it gets weird... When changing to three or more spaces on line 7:
It does not format at all. Until... there are 2 or more spaces between
-ForEach
and@{
, then it formats correctly.Compounding the issue, if you remove the
It
, the formatting works correctly.Formats to:
Finally: When run through
Invoke-Formatter
in the integrated terminal, formatting occurs as expected:PowerShell Version
Visual Studio Code Version
Extension Version
Steps to Reproduce
See Summary above
Visuals
https://user-images.githubusercontent.com/30301021/166330615-e23be282-6aae-4f80-9384-76535ac081f1.mp4
Logs
No response