vscode-powershell: Formatting not working with 1.7.0
System Details
- Operating system name and version:
- VS Code version:
- PowerShell extension version:
- Output from
$PSVersionTable:
1.22.2 3aeede733d9a3098f7b4bdc1f66b63b0f48c1ef9 x64
ajor Minor Build Revision
1 7 0 0
CoenraadS.bracket-pair-colorizer@1.0.37 eamodio.gitlens@8.2.4 formulahendry.docker-explorer@0.1.6 gerane.Theme-Blackboard@0.0.2 ms-mssql.mssql@1.3.1 ms-vscode.PowerShell@1.7.0 ms-vsliveshare.vsliveshare@0.2.489 PKief.material-icon-theme@3.3.0
Name Value
PSVersion 5.1.16299.251 PSEdition Desktop PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…} BuildVersion 10.0.16299.251 CLRVersion 4.0.30319.42000 WSManStackVersion 3.0 PSRemotingProtocolVersion 2.3 SerializationVersion 1.1.0.1
Issue Description
Formatting is not working I have tried this with Insiders and normal versions with a couple of different scripts with the same results

Attached Logs
You can see the log entries in the gif, it just says formatting finished but can upload more if you wish
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 1
- Comments: 16 (6 by maintainers)
@SQLDBAWithABeard Just to document, importing the module from within VSCode won’t resolve the issue because PSScriptAnalyzer starts from a runspace pool when the extension starts up (which is precisely why using the
-MinimumVersionflag is tricky).PSScriptAnalyzer runs in its own sandbox essentially, so state changes in the editor won’t affect it. It works by sending the text of the script into the sandbox over to it and spitting results back out. This is good because it means it doesn’t depend on the state of the editor, so it can be parallelised.
Then when you start the extension up (formally, when you start the EditorServices process, which the extension does), it tacks its own modules directory onto the end of the module path. Which is nice because it means you can override its internal module versions by just sticking your own module anywhere on your module path. And the intent is that eventually it should be possible to integrate other modules with the extension just by having them on the path.
The problem was that despite going to the trouble of using the module path, we weren’t honouring it. Except now we have the issue that an incompatible version of PSScriptAnalyzer on the module path can break us, so we need to address that by somehow specifying what our version constraints are at load time…
@andikrueger it depends on whether you installed PSSciptAnalyzer with
-Scope CurrentUser. For example, my PSModule path is:if I were to do
The module would end up in the first location (aka the current user scope) in my PSModulePath:
if I were to do
The module would end up in the second location in my PSModulePath:
It’s this again. I have 1.16.1 fodler in $HOME.vscode-insiders\extensions\ms-vscode.powershell-1.7.0\modules\PSScriptAnalyzer this time.
2018-04-28 07:41:40 [ERROR] - Method “InvokePowerShell” at line 445 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Analysis\AnalysisService.cs
1524897678-76060de6-59b9-4e70-9686-24a835ab003d1524897335539.zip