question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

VS Code Formatting Instability

See original GitHub issue

Prerequisites

  • 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:closed
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
rjmholtcommented, Sep 15, 2021

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.

1reaction
potatoqualiteecommented, Sep 15, 2021

awesome news all around! thanks so much for the updates 💯

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unstable · Issue #105495 · microsoft/vscode - GitHub
This issue is here to signal the instability and unhealthiness of the whole VS Code extensions ecosystem. Most of the time I update...
Read more >
Extensions Capabilities Overview - Visual Studio Code
Learn the details of what's possible with Visual Studio Code's rich extension (plug-in) API.
Read more >
How to format on save with the Deno VSCode extension?
Found it, I have to turn on formatting on save and specifying the Deno extension as the default formatter { "deno.enable": true, "editor....
Read more >
10 Must-have VS Code Extensions for JavaScript Developers
In this article, I'll focus on a list of must-have VS Code extensions for JavaScript developers. Visual Studio Code is undoubtedly the most ......
Read more >
Python in Visual Studio Code Gets 3 New Extensions
Microsoft's Python in Visual Studio Code dev team introduced three new extensions: Black Formatter, isort and Jupyter Powertoys.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found