Skip to content

Code formatting preset - Add ability to override settings set by preset #5109

Closed as not planned

Description

Prerequisites

  • I have written a descriptive issue title.
  • I have searched all issues to ensure it has not already been reported.

Summary

Edit 2026-03-07:


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

Activity

  1. added
    Issue-Enhancement
    Needs: Triage
    on Dec 1, 2024
  2. added
    Up for Grabs
    and removed
    Needs: Triage
    on Dec 3, 2024
  3. andyleejordan commented on Dec 3, 2024

    @andyleejordan
    Member

    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.

  4. JustinGrote commented on Dec 3, 2024

    @JustinGrote
    Collaborator

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-EnhancementUp for Grabs

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions