GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — [Formatter] Do not force indentation style unless certain line length were met · Issue #2148 · PowerShell/PSScriptAnalyzer

[Formatter] Do not force indentation style unless certain line length were met #2148

New issue
Copy link
New issue
Copy link
Open
Open
[Formatter] Do not force indentation style unless certain line length were met#2148
Copy link
Labels
Issue-EnhancementUp for Grabs

Description

@sharpchen
sharpchen (sharpchen)
opened on Dec 11, 2025
Issue body actions

Prerequisites

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

Summary

Formatter always format code as the specified indent style no matter how long the statement is:

# before
$foo = if ($true) {1} else {0}

# after 
$foo = if ($true) {
    1
} else {
    0
}

# expected
$foo = if ($true) { 1 } else { 0 }

The code became too sparse by being enforced to the indentation style.

Proposed Design

No response

Reacted by Olav Rønnestad Birkeland

Activity

  1. sharpchen (sharpchen)
    added
    Issue-Enhancement
    on Dec 11, 2025
  2. Andy Jordan (andyleejordan)
    transferred this issue fromPowerShell/PowerShellEditorServiceson Dec 23, 2025
  3. bergmeister commented on Mar 31, 2026

    @bergmeister
    Christoph Bergmeister (bergmeister)
    on Mar 31, 2026
    Collaborator
    More actions

    I get the idea but implementation might not be trivial because the rules count indentation levels and I feel like it's more about what inside braces. Maybe having a way to add comment to skip additional indentation for next line could be easier implementation.

  4. Christoph Bergmeister (bergmeister)
    added
    Up for Grabs
    on Mar 31, 2026
  5. sharpchen commented on Mar 31, 2026

    @sharpchen
    sharpchen (sharpchen)
    on Mar 31, 2026
    Author
    More actions

    Maybe having a way to add comment to skip additional indentation for next line could be easier implementation.

    That's the very reason I opened #2151

    Would it be possible to do recursive calculation from inner scope to outer?
    If inner scope has to expand by indentation, the outer should expand too. If no inner scope exists, we should respect the max line length to decided whether to expand etc.

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

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.