-
Notifications
You must be signed in to change notification settings - Fork 523
Open
Labels
Area-Script AnalysisIssue-EnhancementA feature request (enhancement).A feature request (enhancement).
Milestone
Description
Issue Description
The extension's formatter is ignoring the config file: PSScriptAnalyzerSettings.psd1
I didn't file this in /PSScriptAnalyzer because it (Invoke-Formatter) works as expected with the same config file.
Properties set under "powershell.codeFormatting.* are working.
Except it's ignoring "powershell.scriptAnalysis.settingsPath": "PSScriptAnalyzerSettings.psd1" when formatting.
I can disable changing process using Invoke-Formatter using this config
@{
'Rules' = @{
'PSAvoidUsingCmdletAliases' = @{
'Whitelist' = @('process')
}
}
}Expected Behaviour
Input example:
function foo {
param ()
Process {
ls
process
}
}Should format as
function foo {
param ()
Process {
Get-ChildItem
process
}
}Actual Behaviour
function foo {
param ()
Process {
Get-ChildItem
Get-Process
}
}System Details
A tiny workspace reproduces the example: 2020-10-20 - Invoke-Formatter - ignores config.zip
System Details Output (Click to Expand)
### VSCode version: 1.50.1 d2e414d9e4239a252d1ab117bd7067f125afd80a x64
### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected] [disabled]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
### PSES version: 2.3.0.0
Name Version
---- -------
PowerShellEditorServices.Commands 0.2.0
PowerShellEditorServices.VSCode 0.2.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.0.3
PSEdition Core
GitCommitId 7.0.3
OS Microsoft Windows 10.0.19041
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Attached Logs
Environment Information
Visual Studio Code
| Name | Version |
|---|---|
| Operating System | Windows_NT x64 10.0.19041 |
| VSCode | 1.50.1 |
| PowerShell Extension Version | 2020.9.0 |
PowerShell Information
| Name | Value |
|---|---|
| PSVersion | 7.0.3 |
| PSEdition | Core |
| GitCommitId | 7.0.3 |
| OS | Microsoft Windows 10.0.19041 |
| Platform | Win32NT |
| PSCompatibleVersions | 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.0.0 6.1.0 6.2.0 7.0.3 |
| PSRemotingProtocolVersion | 2.3 |
| SerializationVersion | 1.1.0.1 |
| WSManStackVersion | 3.0 |
Visual Studio Code Extensions
Visual Studio Code Extensions(Click to Expand)
| Extension | Author | Version |
|---|---|---|
| better-toml | bungcip | 0.3.2 |
| Bookmarks | alefragnani | 11.4.0 |
| code-point | medo64 | 1.7.1 |
| code-runner | formulahendry | 0.11.1 |
| cpptools | ms-vscode | 1.0.1 |
| csharp | ms-dotnettools | 1.23.4 |
| debug | webfreak | 0.25.0 |
| debugger-for-chrome | msjsdiag | 4.12.11 |
| font-switcher | evan-buss | 3.1.0 |
| githistory | donjayamanne | 0.6.12 |
| gitlens | eamodio | 10.2.2 |
| hexeditor | ms-vscode | 1.3.0 |
| markdown-all-in-one | yzhang | 3.3.0 |
| material-icon-theme | PKief | 4.3.0 |
| material-theme | zhuangtongfa | 3.9.3 |
| mssql | ms-mssql | 1.9.0 |
| mypy | matangover | 0.1.4 |
| nord-visual-studio-code | arcticicestudio | 0.14.0 |
| path-intellisense | christian-kohler | 2.3.0 |
| powershell-preview | ms-vscode | 2020.9.0 |
| prettier-vscode | esbenp | 5.7.1 |
| python | ms-python | 2020.9.114305 |
| rainbow-csv | mechatroner | 1.7.1 |
| remote-wsl | ms-vscode-remote | 0.50.1 |
| rust | rust-lang | 0.7.8 |
| synthwave-vscode | RobbOwen | 0.1.8 |
| tsl-problem-matcher | eamodio | 0.3.1 |
| vsc-community-material-theme | Equinusocio | 1.4.2 |
| vsc-material-theme | Equinusocio | 33.0.0 |
| vsc-material-theme-icons | equinusocio | 1.2.0 |
| vscode-data-preview | RandomFractalsInc | 2.2.0 |
| vscode-duotone-dark | sallar | 0.3.3 |
| vscode-firefox-debug | firefox-devtools | 2.9.1 |
| vscode-json-transform | octref | 0.1.2 |
| vscode-lldb | vadimcn | 1.6.0 |
| vscode-odata | stansw | 0.1.0 |
| vscode-powerquery | PowerQuery | 0.1.5 |
| vscode-pylance | ms-python | 2020.10.2 |
| vscode-theme-hydra | juanmnl | 3.1.0 |
| vscode-typescript-tslint-plugin | ms-vscode | 1.2.3 |
| vscode-xml | redhat | 0.13.0 |
| vscodeintellicode | VisualStudioExptTeam | 1.2.10 |
manual_invoke_formatter.ps1 (Click to Expand)
$settings = 'PSScriptAnalyzerSettings.psd1'
$src = @'
function foo {
param ()
Process {
ls
process
}
}
'@
$expected = @'
function foo {
param ()
Process {
Get-ChildItem
process
}
}
'@
Write-Host -fore red "Input"
$src
Write-Host -fore red "Result"
$result = Invoke-Formatter -ScriptDefinition $src -Settings $settings
$result
"Expected?"
$result -eq $expectedJaykul
Metadata
Metadata
Assignees
Labels
Area-Script AnalysisIssue-EnhancementA feature request (enhancement).A feature request (enhancement).
Type
Projects
Status
Wishlist