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] Indent Right(hand side) `CommandExpressionAst` · Issue #2175 · PowerShell/PSScriptAnalyzer

[Formatter] Indent Right(hand side) CommandExpressionAst #2175

New issue
Copy link
New issue
Copy link
Open
Open
[Formatter] Indent Right(hand side) CommandExpressionAst#2175
Copy link

Description

@iRon7
iRon7
opened on Apr 20, 2026
Issue body actions

Indent (a multiline) righthand side (list) expression assignment.
Meaning, for a (multiline) Statements.Right CommandExpressionAst (as apposed to Ast's that have already their own embedded indention, as e.g. a PipelineAst), I would like the righthand side to (optionally?) increase the indent:

Wrong way (?)

$List =
'One',
'Two',
'Three'

Correct way

$List =
    'One',
    'Two',
    'Three'

Wrong way (?)

$4 = # or any lengthy variable name aka dot notation
2 + 2

Correct way

$4 = # or any lengthy variable name aka dot notation
    2 + 2

Activity

  1. iRon7
    changed the title [-][Formatter] Right(hand side) list indention[/-] [+][Formatter] Indent Right(hand side) `CommandExpressionAst`[/+] on Apr 21, 2026
  2. bergmeister commented on Apr 21, 2026

    @bergmeister
    Christoph Bergmeister (bergmeister)
    on Apr 21, 2026
    Collaborator
    More actions

    iRon7 are you using latest 1.25.0 release? Cc Liam Peters (@liamjpeters)

  3. iRon7 commented on Apr 21, 2026

    @iRon7
    iRon7
    on Apr 21, 2026
    ContributorAuthor
    More actions

    @iRon7 are you using latest 1.25.0 release? Cc @liamjpeters

    I think I do:

    Get-Command Invoke-Formatter     
    
    CommandType     Name                                               Version    Source
    -----------     ----                                               -------    ------
    Cmdlet          Invoke-Formatter                                   1.25.0     PSScriptAnalyzer

    But under VSCode, it is a little confusing as the PowerShell extension appears to still come with 1.24.0.
    Besides, I noticed another issue, see: PowerShell/vscode-powershell#5474

    Why do you ask?

  4. liamjpeters commented on Apr 22, 2026

    @liamjpeters
    Liam Peters (liamjpeters)
    on Apr 22, 2026
    Contributor
    More actions

    There's nothing that does this currently that I'm aware of.

    It would be hard to do, as most of the formatters (including for indentation) act on the stream of tokens and not the AST.

    They know that there's an equals sign, but not that it's part of a wider expression with a beginning and an end line and column. So it might be trivial to say that indentation can optionally start at an equals token, but where does it then end?

    I guess you could read the AST up front and keep a list of the starts and ends of expressions you want to affect indentation and check that when during token enumeration. It would be messy though and difficult to get right.

  5. iRon7 commented on Apr 22, 2026

    @iRon7
    iRon7
    on Apr 22, 2026
    ContributorAuthor
    More actions

    formatters (including for indentation) act on the stream of tokens and not the AST.

    Thank you for your comment, I wasn't aware of that.

  6. bergmeister commented on May 7, 2026

    @bergmeister
    Christoph Bergmeister (bergmeister)
    on May 7, 2026
    Collaborator
    More actions

    @iRon7 are you using latest 1.25.0 release? Cc @liamjpeters

    I think I do:

    Get-Command Invoke-Formatter

    CommandType Name Version Source


    Cmdlet Invoke-Formatter 1.25.0 PSScriptAnalyzer
    But under VSCode, it is a little confusing as the PowerShell extension appears to still come with 1.24.0. Besides, I noticed another issue, see: PowerShell/vscode-powershell#5474

    Why do you ask?

    VS Code PowerShell extension ships with PSSA version and binds to that one.

    Therefore until it gets updated, please try repro using Invoke-Formatter (Get-Content -Raw) in a different terminal other than the integrated one of VS-Code extension

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

    No labels
    No labels

    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.