Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

powershell VSCODE integrated formatter breaks certain linux commands on save by default #5198

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

Open
6 tasks done
NickVH-MS opened this issue May 22, 2025 · 1 comment
Open
6 tasks done
Labels
Area-Code Formatting Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!

Comments

@NickVH-MS
Copy link

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

we made major changes to a .ps1 file. All was well until save and the powershell extension's formatter saw:

mount / -o remount,rw

And changed it to

mount / -o remount, rw

Which of course DESTROYS THE ENTIRE PIPELINE. We lost days of time investigating this ridiculous issue.
Please do not auto-format such commands, ever!

PowerShell Version

PS /home/nverhoe/fd> $PSVersionTable; $Host          

Name                           Value
----                           -----
PSVersion                      7.5.1
PSEdition                      Core
GitCommitId                    7.5.1
OS                             Ubuntu 22.04.5 LTS
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Name             : ConsoleHost
Version          : 7.5.1
InstanceId       : 940da084-2fa0-4144-bb67-1f8bdd981c26
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : 
CurrentUICulture : 
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace


PS /home/nverhoe/fd>

Visual Studio Code Version

PS /home/nverhoe/fd> code --version
1.100.2
848b80aeb52026648a8ff9f7c45a9b0a80641e2e
x64

Extension Version

PS /home/nverhoe/fd> code --list-extensions --show-versions | Select-String powershell

ms-vscode.powershell@2025.0.0

Steps to Reproduce

Install Vscode powershell extension.
Within vscode, create a .ps1 file containing:

mount / -o remount,rw

Save.

Line changes and breaks

Visuals

No response

Logs

No response

@NickVH-MS NickVH-MS added Issue-Bug A bug to squash. Needs: Triage Maintainer attention needed! labels May 22, 2025
@JustinGrote
Copy link
Collaborator

Thanks for your submission!

Sorry for the frustration that caused you.

Does this happen when you run Invoke-ScriptAnalyzer on the same script? If so, then your issue needs to be filed in https://github.com/PowerShell/PSScriptAnalyzer, as the vscode extension basically just runs that and applies its recommendations.

@JustinGrote JustinGrote added Area-Code Formatting Needs: Author Feedback Please give us the requested feedback! and removed Needs: Triage Maintainer attention needed! labels May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Code Formatting Issue-Bug A bug to squash. Needs: Author Feedback Please give us the requested feedback!
Projects
None yet
Development

No branches or pull requests

2 participants