Skip to content
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

Format on save hangs with PowerShell v7.5.0, runs fine with v7.4.7 #5134

Closed
6 tasks done
o-l-a-v opened this issue Feb 2, 2025 · 6 comments
Closed
6 tasks done

Format on save hangs with PowerShell v7.5.0, runs fine with v7.4.7 #5134

o-l-a-v opened this issue Feb 2, 2025 · 6 comments
Labels
Issue-Bug A bug to squash.

Comments

@o-l-a-v
Copy link
Contributor

o-l-a-v commented Feb 2, 2025

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all open and closed issues to ensure it has not already been reported.
  • I have read the troubleshooting guide.
  • I am sure this issue is with the extension itself and does not reproduce in a standalone PowerShell instance.
  • I have verified that I am using the latest version of Visual Studio Code and the PowerShell extension.
  • If this is a security issue, I have read the security issue reporting guidance.

Summary

Format on save hangs with PowerShell v7.5.0, it never completes. Works fine with PowerShell v7.4.7.

I've tried with v7.5.0 managed by mise (ref: #5123 (comment)), and downloaded and unzipped v7.5.0 ZIP myself.

  • Windows 11 x64 24H2
  • VSCode v1.96.4
  • vscode-powershell v2025.0.0
    • Also tried with preview version v2025.1.0

PowerShell Version

v7.5.0 x64 Windows

Name             : Visual Studio Code Host
Version          : 2025.1.0
InstanceId       : dd17a949-7d42-4f49-b509-b842f6923341
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : nb-NO
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace

Visual Studio Code Version

1.96.4
cd4ee3b1c348a13bafd8f9ad8060705f6d4b9cba
x64

Extension Version

Steps to Reproduce

  • Use PowerShell v7.5.0
  • Configure format on save for PowerShell in VSCode
  • Open PS1 file, do changes, CTRL + S to save
  • VSCode hangs, formatting never happens

Visuals

Image

Logs

I've added following config:

{
  "powershell editor services.trace.server": "Verbose",
  "powershell.developer.editorServicesLogLevel": "Trace"
}

I see no relevant log events.

  • Is "powershell editor services.trace.server" relevant anymore?
@o-l-a-v o-l-a-v added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels Feb 2, 2025
@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Feb 3, 2025

I can't reproduce on my work computer, so I don't know what is going on here.

If I find out where to get relevant logs I'll add more info.

@andyleejordan
Copy link
Member

Thanks as alwyas @o-l-a-v, let me know if it crops up again.

@andyleejordan andyleejordan removed the Needs: Triage Maintainer attention needed! label Feb 4, 2025
@JustinGrote
Copy link
Collaborator

@o-l-a-v to answer your question, the first line is no longer relevant, but powershell.trace.server is, it's configurable in the options menu now, it's not a "hidden" setting, and the logging is much better in the latest version of the extension.

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Feb 4, 2025

Thanks @JustinGrote. I set that to verbose, I guess the output is added to output tab -> PowerShell: Trace LSP? It does not log anything when this issue is reproduced, and all it logs before it is:

2025-02-04 20:51:23.642 [info] No parameters provided.
2025-02-04 20:51:28.275 [info] No result returned.

Maybe this is a VSCode problem, or some other extension interfering.


Edit 1: Created a new temporary VSCode profile. Added PowerShell and EditorConfig extension only, with settings.json:

{
    "editor.formatOnSave": true,
    "powershell.developer.editorServicesLogLevel": "Trace",
    "powershell.powerShellAdditionalExePaths": {
        "7.5": "Z:\\Programs\\PowerShell\\7.5\\pwsh.exe"
    },
    "powershell.powerShellDefaultVersion": "7.5",
    "powershell.trace.server": "verbose"
}

And it worked. I'll nuke my default profile I guess.


Edit 2: Testing my default profile with just the config above: It worked. Must be some conflicting setting.

@JustinGrote
Copy link
Collaborator

The new logging has different log levels that unify with VScode. You need to set your log level to debug or trace in vscode for the ps extension (or globally).

I'm actually having a hard time finding a doc on this, guess I should contribute one to the vscode docs repo.

Two ways to do the same thing:
Image
Image
Image

@o-l-a-v
Copy link
Contributor Author

o-l-a-v commented Feb 5, 2025

I ended up uninstalling VSCode, deleted %APPDATA%\Code and %USERPROFILE%\.vscode, installed VSCode, loaded the exact same user settings.json, and now it works again.

@o-l-a-v o-l-a-v closed this as completed Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug A bug to squash.
Projects
None yet
Development

No branches or pull requests

3 participants