vscode-powershell: Formatting no longer works

System Details

System Details Output

### VSCode version: 1.42.1 c47d83b293181d9be64f27ff093689e8e7aed054 x64

### VSCode extensions:
bencoleman.armview@0.3.3        
bibhasdn.unique-lines@1.0.0     
cssho.vscode-svgviewer@2.0.0    
eamodio.gitlens@10.2.1
EditorConfig.EditorConfig@0.14.4
GrapeCity.gc-excelviewer@2.1.34
humao.rest-client@0.23.2
JuliaBay.spellcheck@1.1.4
ms-azure-devops.azure-pipelines@1.165.1
ms-azuretools.vscode-azurefunctions@0.21.0
ms-dotnettools.csharp@1.21.13
ms-mssql.mssql@1.9.0
ms-vscode-remote.remote-wsl@0.42.3
ms-vscode.azure-account@0.8.8
ms-vscode.powershell@2020.3.0
ms-vsts.team@1.161.0
Zignd.html-css-class-completion@1.19.0


### PSES version: 2.0.0.0

### PowerShell version:

Name                           Value
----                           -----
PSVersion                      7.0.0
PSEdition                      Core
GitCommitId                    7.0.0
OS                             Microsoft Windows 10.0.18363
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Issue Description

Latest version of extension no longer formats scripts

Expected Behaviour

It should format the script like it has forever.

Actual Behaviour

Nothing happens

Attached Logs

Follow the instructions in the troubleshooting docs about capturing and sending logs. 1583792484-d9b584fd-a4f6-4b7e-9d35-4bec4545762c1583792481203.zip

Copy-ReleaseVariablesToVariableGroup.zip

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 37 (17 by maintainers)

Most upvoted comments

any progress on this? the world is pretty much upside down right now and much more important things are staring us in the face. but if you’re all still healthy and able to work, can you please let me know when you think you might have a solution. it really sucks writing powershell without a formatter. on the other hand, i’m grateful that i still have the luxury to care about something like this. thanks

Also your script that wasn’t formatted correctly would also be hugely helpful.

sure looks fixed to me guys! i hammered on it as much as i could and it does everything the pre-update version did.

thanks a lot for staying on this for so long. it sure makes my job a lot easier. i have a hard time reading my own code when it’s not formatted consistently. i spend almost all my time writing posh code these days and it’s been very frustrating. i really appreciate your work.

@elrod-johnson that is VERY helpful. Ok. We are getting closer I can feel it. I have 2 suggestions:

  1. Can you run the formatter manually like so in the PowerShell Integrated Console:
# With Registry-Load-Hive.ps1 open
Invoke-Formatter -ScriptDefinition $psEditor.GetEditorContext().CurrentFile.GetText()
# Or
Invoke-Formatter -ScriptDefinition (Get-Content -Raw ./path/to/Registry-Load-Hive.ps1)

And let me know if the output is what you expect.

  1. I have another vsix for you! This time with some logging closer to where the issue lies: psvsix.zip

Thank you soooo much for your help. I want to get to the bottom of this for you.

Hi @motowilliams, can you please attach your logs as described in the last link in your issue description?