Skip to content

VS Code Formatting Instability #3565

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

Closed
4 tasks done
potatoqualitee opened this issue Sep 14, 2021 · 5 comments
Closed
4 tasks done

VS Code Formatting Instability #3565

potatoqualitee opened this issue Sep 14, 2021 · 5 comments
Labels
Issue-Discussion Let's talk about it.

Comments

@potatoqualitee
Copy link
Contributor

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: #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

Steps to Reproduce

Code PowerShell in VS Code and wait 😅

Visuals

No response

Logs

No response

@potatoqualitee potatoqualitee added the Issue-Bug A bug to squash. label Sep 14, 2021
@ghost ghost added the Needs: Triage Maintainer attention needed! label Sep 14, 2021
@andyleejordan
Copy link
Member

Hey Chrissy!

Super great to hear things are finally starting to work better ☺️ The PSScriptAnalyzer update was a tremendous collaboration among the team, and I was so happy to be able to pick it up! It seems to have solved a lot of issues for everyone. That said, it clearly has room for improvement, and I'm hoping we can do that work.

As far as the "large chunk" of code randomly moving/pasting...I feel like I know what you're talking about. I've seen similar things happen in both VS Code with other extensions and in Emacs using various LSP plugins. It seems like a bigger issue than just us, and unfortunately it's a really hard one to nail down because it happens so randomly. I hope we can get a repro of this and finally figure it out.

As for the "rewrite" we got half of that done with the move to OmniSharp, and then the subsequent update to OmniSharp itself. However, @rjmholt is still hard at working at the rest of it, which I'll let him fill in after me. We hope to be able to share more at the community call as well.

@andyleejordan andyleejordan added Issue-Discussion Let's talk about it. and removed Needs: Triage Maintainer attention needed! Issue-Bug A bug to squash. labels Sep 14, 2021
@potatoqualitee
Copy link
Contributor Author

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

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 15, 2021
@potatoqualitee
Copy link
Contributor Author

also glad to know that chunks of code thing is not a ps extension problem. hopefully it will get fixed at that level 👍🏼

@andyleejordan andyleejordan removed the Needs: Maintainer Attention Maintainer attention needed! label Sep 15, 2021
@rjmholt
Copy link
Contributor

rjmholt commented 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 PowerShell/PowerShellEditorServices#1459. I've just opened PowerShell/PowerShellEditorServices#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.

@potatoqualitee
Copy link
Contributor Author

fantastic news! Thank you @rjmholt 🥳

@ghost ghost added the Needs: Maintainer Attention Maintainer attention needed! label Sep 16, 2021
@StevenBucher98 StevenBucher98 removed the Needs: Maintainer Attention Maintainer attention needed! label Sep 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Discussion Let's talk about it.
Projects
None yet
Development

No branches or pull requests

4 participants