Skip to content

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

Open
@NickVH-MS

Description

@NickVH-MS

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions