vscode-powershell
vscode-powershell copied to clipboard
Code formatting preset - Add ability to override settings set by preset
Prerequisites
- [X] I have written a descriptive issue title.
- [X] I have searched all issues to ensure it has not already been reported.
Summary
A lot of people including me like OTBS with else on a new line.
To achieve this with vscode-powershell one have to use "powershell.codeFormatting.preset": "Custom" and set all formatting rules one by one.
It'd be nice with the ability to override any setting set by a preset. If this is not possible or feasible maybe a new preset can be added to PSScriptAnalyzer:
Proposed Design
No response
Ah I see what you mean, I'll mark this as Up For Grabs. I'd take a PR if it can do this reasonably suscinctly.
These "presets" are a PSES concept and not a scriptanalyzer concept. They are defined here: https://github.com/PowerShell/PowerShellEditorServices/blob/42d13997e346de4601a08b7ab04a5207656ae1dd/src/PowerShellEditorServices/Services/Workspace/LanguageServerSettings.cs#L218-L247
So a PR could be fairly straightforward to just add a new entry to the enum with the appropriate settings. Changing the switch to an exhausive pattern matching would also help catch any net-new issues.