VS Code Formatting Instability
See original GitHub issuePrerequisites
- I have written a descriptive issue title.
- I have searched all issues to ensure it has not already been reported.
- I have read the troubleshooting guide.
- I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
Summary
Hey Andy, as a follow up to my comment on the Community Call thread, this may have resolved the issue: https://github.com/PowerShell/vscode-powershell/issues/3524
On July 22, I presented at a PS UG meeting and my formatting was not working – as it hadn’t been for a couple weeks. Others on the call confirmed they were having the same issues. Here are the issues I encountered:
- I would get alerts that my code wasn’t formatted properly, but then VS Code would not format it so I had to manually tab to get my code properly aligned
- Even though I disabled Format on Save, I’d get a popup that it was trying to format which would stay there until I closed it manually
- As I was coding, I’d suddenly see a large chunk of yellow code in my minimap, which usually means – and this happens every few months perhaps – that VS Code would copy/paste a huge chunk of code and place it randomly in the file. Sometimes, reopening VS Code helps, but in that case it did not. This was particularly bad the week of August 31st. When closing/reopening does work, there are days that I have to do it every 10 minutes.
Since then, time has passed and I’ve seen the extension get updated. I’ve also updated psreadline across the board, no idea if that impacts anything. Either way, so far this week, things are working well and formatting works nicely 🎉
As for my second question about a rewrite: because extension instability is an on-going issue (it’s happened regularly for years), it’s my assumption that these issues were going to be permanently fixed as part of the rewrite of the VS Code PowerShell extension. Last time I was on a community call, Steve said Extension instability has to do with the underlying engine, Onyx or Ultima or something, and that the extension was being rewritten to use something else. So I was inquiring about timeline for the total rewrite.
PowerShell Version
Name Value
---- -----
PSVersion 5.1.22454.1000
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.22454.1000
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Visual Studio Code Version
1.60.0
e7d7e9a9348e6a8cc8c03f877d39cb72e5dfb1ff
x64
Extension Version
ms-vscode.powershell-preview@2021.9.0
Steps to Reproduce
Code PowerShell in VS Code and wait 😅
Visuals
No response
Logs
No response
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top GitHub Comments
Just to follow up here, the work to improve the fundamental issues in how PowerShell is executed in the extension is being done in https://github.com/PowerShell/PowerShellEditorServices/pull/1459. I’ve just opened https://github.com/PowerShell/PowerShellEditorServices/pull/1574 onto that branch, which implements debugging (which took much much longer than anticipated because PowerShell’s debugger is quite complex, especially when remoting).
There are a number of smaller things we need to implement still, but with the debug implementation done we should pretty much be on the home stretch.
awesome news all around! thanks so much for the updates 💯