PowerShell / PowerShell/PSScriptAnalyzer
Format indention of multiline statements
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 2.2k
- Forks
- 414
- Avg merge
- 13h 1m
- Merged PRs (30d)
- 2
Description
Summary of the new feature
Enhance formatting of continued (multiline) statements (command and expression), combining the PipeLineIndentionStyle with statement continuation.
There are a lot of means to continue command statements, including pipe lines. especially so with expressions. I, myself, prefer all continued statements to be indented, but currently the formatting only supports indenting when a brace or parenthesis is involved, or optionally with a pipe line.
Proposed technical implementation details (optional)
I actually think the details of pipe line continuation gets simpler when the entire statement's continuation is taken in to account.
I am not fully understanding of how the formatting mechanism works, so this is a fundamental concept to how I would think it would work.
If using PowerShell AST's, for each PipeLineAst/CommandExpressionAst/etc, add 1 indention level to subsequent lines, in addition to all other indenting even for the same PipeLineAst.
There might be a need to restrict the continuation indention of a PipeLine or CommandExpression if they are the sole contents of a ParenExpression, because in that case, the PipeLine or CommandExpression is fully captured in the indention of the ParenExpression, as technically only one expression should appear in such cases, unlike a scriptblock or statementblock where multiple statements or expressions could appear.
I need to gather some examples to better demonstrate my use case.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files or tests are named. Start by locating the formatting mechanism and the PowerShell AST handling for PipeLineAst and CommandExpressionAst; gather the missing multiline examples, then define completion as consistent continuation indentation, including the stated parenthesized-expression distinction, with tests covering the behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, powershell
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100