Skip to content

POC for powershell formatting - #1894

Open
belav wants to merge 7 commits into
mainfrom
powershell-poc
Open

belav wants to merge 7 commits into
mainfrom
powershell-poc

Conversation

@belav

@belav belav commented Aug 4, 2026

Copy link
Copy Markdown
Owner

No description provided.

@belav
belav force-pushed the powershell-poc branch 4 times, most recently from a325e57 to 5cf1850 Compare August 9, 2026 21:09
# Conflicts:
#	Src/CSharpier.Core/CSharp/SyntaxPrinter/Token.cs
#	Src/CSharpier.Playground/CSharpier.Playground.csproj

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved critical issues can change PowerShell semantics by treating comment text as switch flags or property names, and cause playground requests to fail on deeply nested expressions or syntax errors.

5 open issues
What changed in this PR

This proof of concept adds PowerShell formatting to CSharpier’s shared formatting engine and exposes it through the CLI, editor integrations, and playground.

Changes:

  • Adds PowerShell file detection, syntax printers, validation integration, and syntax-tree serialization.
  • Adds formatting fixtures, idempotency checks, and CLI/server coverage.
  • Updates editor support, playground controls, dependencies, and documentation.
File Description
Src/​Website/​docs/​Pre-commit.md Adds PowerShell hook patterns.
Src/​Website/​docs/​Ignore.md Documents ignore limitations.
Src/​Website/​docs/​Configuration.md Documents PowerShell configuration.
Src/​Website/​docs/​CLI.md Documents PowerShell stdin handling.
Src/​Website/​docs/​About.md Lists PowerShell support.
Src/​CSharpierProcess.Tests/​ServerTests.cs Tests server formatting.
Src/​CSharpierProcess.Tests/​CliTests.cs Tests PowerShell CLI paths.
Src/​CSharpier.VSCode/​src/​Extension.ts Enables PowerShell formatting.
Src/​CSharpier.VSCode/​package.json Adds PowerShell activation.
Src/​CSharpier.VisualStudio/​CSharpier.VisualStudio/​FormattingService.cs Recognizes PowerShell documents.
Src/​CSharpier.Tests/​PowerShell/​PowerShellResolutionErrorTests.cs Tests resolution-error handling.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​WhileStatement.test Adds while-loop cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​WhileStatement.expected.test Defines while-loop output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​VerbatimFallbacks.test Adds fallback cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​VerbatimFallbacks.expected.test Defines fallback output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​UsingStatement.test Adds using-statement cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​UsingStatement.expected.test Defines using-statement output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​UsingExpression.test Covers scoped using expressions.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​UnaryExpression.test Adds unary-expression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​UnaryExpression.expected.test Defines unary-expression output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition.test Adds class-definition cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition.expected.test Defines class-definition output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition_Tabs.test Adds tab-indented class cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition_Tabs.expected.test Defines tab-indented class output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition_Enum.test Adds enum cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TypeDefinition_Enum.expected.test Defines enum output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TryStatement.test Adds exception-handling cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TryStatement.expected.test Defines exception-handling output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Try.test Covers formatted try blocks.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TrapStatement.test Adds trap cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TrapStatement.expected.test Defines trap output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ThrowStatement.test Adds throw cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ThrowStatement.expected.test Defines throw output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TernaryExpression.test Adds ternary cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​TernaryExpression.expected.test Defines ternary output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​SwitchStatement.test Adds switch cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​SwitchStatement.expected.test Defines switch output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​SubExpression.test Adds subexpression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​SubExpression.expected.test Defines subexpression output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StopParsing.test Covers stop-parsing arguments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StopParsing.expected.test Defines preserved argument output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StatementBlock.test Adds statement-block cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StatementBlock.expected.test Defines statement-block output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StatementBlock_Tabs.test Adds nested tab-indentation cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​StatementBlock_Tabs.expected.test Defines nested tab output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ScriptBlockExpression.test Adds script-block expression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ScriptBlockExpression.expected.test Defines script-block expression output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ScriptBlock.test Adds script-layout cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ScriptBlock.expected.test Defines script-layout output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ReturnStatement.test Adds return cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ReturnStatement.expected.test Defines return output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Redirection.test Adds redirection cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Redirection.expected.test Defines redirection output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Random.test Adds a complete script sample.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Random.expected.test Defines sample-script output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PropertyMember.test Adds property cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PropertyMember.expected.test Defines property output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PropertyMember_Braces.test Covers braced property names.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PropertyMember_Braces.expected.test Defines braced-name output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PipelineChain.test Adds pipeline-chain cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​PipelineChain.expected.test Defines pipeline-chain output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Pipeline.test Adds pipeline cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Pipeline.expected.test Defines pipeline output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParenExpression.test Adds parenthesized-expression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParenExpression.expected.test Defines parenthesized output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Parameter.test Adds parameter cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Parameter.expected.test Defines parameter output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParamBlock.test Adds parameter-block cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParamBlock.expected.test Defines parameter-block output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParamBlock_Comments.test Covers parameter-block comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ParamBlock_Comments.expected.test Defines parameter-comment output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​NamedBlock.test Adds named-block cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​NamedBlock.expected.test Defines named-block output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​NamedBlock_Function.test Covers function lifecycle blocks.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​NamedBlock_Function.expected.test Defines lifecycle-block output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​MemberExpression.test Adds member-access cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​MemberExpression.expected.test Defines member-access output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Leaves.test Covers literal and token preservation.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Labels.test Adds labeled-statement cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Labels.expected.test Defines labeled-statement output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​InvokeMemberExpression.test Adds method-call cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​InvokeMemberExpression.expected.test Defines method-call output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​IndexExpression.test Adds indexing cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​IndexExpression.expected.test Defines indexing output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​IfStatement.test Adds conditional cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​IfStatement.expected.test Defines conditional output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​HereString.test Covers here-string preservation.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Hashtable.test Adds hashtable cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Hashtable.expected.test Defines hashtable output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​FunctionMember.test Adds class-method cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​FunctionMember.expected.test Defines class-method output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​FunctionDefinition.test Adds function-definition cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​FunctionDefinition.expected.test Defines function-definition output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Function.test Adds a basic function sample.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Function.expected.test Defines basic function output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ForStatement.test Adds for-loop cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ForStatement.expected.test Defines for-loop output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ForEachStatement.test Adds foreach cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ForEachStatement.expected.test Defines foreach output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Foreach.test Covers nested loop conditionals.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ExpandableStringExpressions.test Covers string interpolation preservation.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ExitStatement.test Adds exit-statement cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ExitStatement.expected.test Defines exit-statement output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Exit.test Covers a formatted exit statement.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DoWhileStatement.test Adds do-while cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DoWhileStatement.expected.test Defines do-while output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DoUntilStatement.test Adds do-until cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DoUntilStatement.expected.test Defines do-until output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DataStatement.test Adds data-statement cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​DataStatement.expected.test Defines data-statement output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ConvertExpression.test Adds conversion cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ConvertExpression.expected.test Defines conversion output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ContinueStatement.test Adds continue cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ContinueStatement.expected.test Defines continue output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments.test Covers basic comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Unformatted.test Adds comment-formatting cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Unformatted.expected.test Defines comment-formatting output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Trap.test Covers comments around traps.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Trap.expected.test Defines trap-comment output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Trailing.test Covers trailing comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Pipeline.test Covers pipeline comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_ParamBlock.test Covers parameter comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_OnlyContentOfBlock.test Covers comment-only blocks.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_OnlyComments.test Covers comment-only scripts.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_MultiLineBlock.test Covers multiline help comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Keywords.test Covers comments near keywords.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Keywords.expected.test Defines keyword-comment output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Hashtable.test Covers hashtable comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_EndOfFile.test Covers final comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockInExpression.test Covers inline block comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndentTabSource.test Adds tab-indented comment input.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndentTabSource.expected.test Defines comment indentation conversion.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndent.test Adds block-comment indentation cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndent.expected.test Defines block-comment indentation.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndent_Tabs.test Adds comment tab-output cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BlockIndent_Tabs.expected.test Defines tab-indented comments.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_BetweenBraceAndElse.test Covers comments between clauses.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Arguments.test Adds argument-comment cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Comments_Arguments.expected.test Defines argument-comment output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​CommandParameter.test Adds command-parameter cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​CommandParameter.expected.test Defines command-parameter output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Command.test Adds command-formatting cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Command.expected.test Defines command output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Casing.test Adds keyword-casing cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Casing.expected.test Defines normalized keyword casing.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​BreakStatement.test Adds break cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​BreakStatement.expected.test Defines break output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​BaseCtorInvokeMemberExpression.test Adds base-constructor cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​BaseCtorInvokeMemberExpression.expected.test Defines base-constructor output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​AttributedExpression.test Adds attributed-expression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​AttributedExpression.expected.test Defines attributed-expression output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Attribute.test Adds attribute cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​Attribute.expected.test Defines attribute output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​AssignmentStatement.test Adds assignment cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​AssignmentStatement.expected.test Defines assignment output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ArrayLiteral.test Adds array-literal cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ArrayLiteral.expected.test Defines array-literal output.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ArrayExpression.test Adds array-expression cases.
Src/​CSharpier.Tests/​FormattingTests/​TestFiles/​powershell/​ArrayExpression.expected.test Defines array-expression output.
Src/​CSharpier.Tests/​FormattingTests/​PowerShellFormatting.cs Registers PowerShell fixture tests.
Src/​CSharpier.Tests/​FormattingTests/​BaseTest.cs Adds validation and idempotency checks.
Src/​CSharpier.Rider/​src/​main/​java/​com/​intellij/​csharpier/​FormattingService.java Recognizes PowerShell documents.
Src/​CSharpier.Playground/​Program.cs Reformats host-builder method.
Src/​CSharpier.Playground/​Controllers/​FormatController.cs Separates PowerShell validation handling.
Src/​CSharpier.Playground/​ClientApp/​src/​Layout.tsx Loads additional syntax modes.
Src/​CSharpier.Playground/​ClientApp/​src/​Hooks.ts Selects language-specific highlighting.
Src/​CSharpier.Playground/​ClientApp/​src/​FormatCode.ts Handles invalid syntax-tree JSON.
Src/​CSharpier.Playground/​ClientApp/​src/​Controls.tsx Adds PowerShell selection.
Src/​CSharpier.Playground/​ClientApp/​src/​CodeEditor.tsx Loads PowerShell/XML highlighting.
Src/​CSharpier.Generators/​PowershellNodeGenerator.sbntxt Adds printer-dispatch template.
Src/​CSharpier.Generators/​NodePrinterGenerator.sbntxt Reformats C# dispatch template.
Src/​CSharpier.Core/​Utilities/​DocListBuilder.cs Reformats Clear method.
Src/​CSharpier.Core/​PrinterOptions.cs Maps PowerShell extensions.
Src/​CSharpier.Core/​PowerShell/​Verbatim.cs Preserves source extents.
Src/​CSharpier.Core/​PowerShell/​PowerShellPrinter.cs Initializes PowerShell printing.
Src/​CSharpier.Core/​PowerShell/​PowerShellParseErrors.cs Classifies resolution errors.
Src/​CSharpier.Core/​PowerShell/​Layout.cs Adds layout predicates.
Src/​CSharpier.Core/​PowerShell/​Condition.cs Prints parenthesized conditions.
Src/​CSharpier.Core/​PowerShell/​AstSyntaxWriter.cs Serializes PowerShell syntax trees.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​WhileStatement.cs Prints while loops.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​VariableExpression.cs Preserves variable spelling.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​UsingStatement.cs Prints using statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​UsingExpression.cs Preserves using expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​UnaryExpression.cs Prints unary operators.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TypeExpression.cs Preserves type expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TypeDefinition.cs Prints class and enum definitions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TypeConstraint.cs Preserves type constraints.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TryStatement.cs Prints exception-handling clauses.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TrapStatement.cs Prints trap statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ThrowStatement.cs Prints throw statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​TernaryExpression.cs Prints conditional expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​SwitchStatement.cs Prints switch headers and clauses.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​SubExpression.cs Prints subexpressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ScriptBlockExpression.cs Prints script-block expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ScriptBlock.cs Arranges script contents.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ReturnStatement.cs Prints return statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​PropertyMember.cs Prints properties and enum members.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​PipelineChain.cs Prints pipeline chains.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​Pipeline.cs Prints pipelines and continuations.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ParenExpression.cs Prints parenthesized expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​Parameter.cs Prints parameters and attributes.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​NamedBlock.cs Prints lifecycle blocks.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​NamedAttributeArgument.cs Prints named attribute arguments.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​MergingRedirection.cs Preserves stream merging.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​MemberExpression.cs Prints member access.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​InvokeMemberExpression.cs Prints method invocations.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​IndexExpression.cs Prints indexing expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​IfStatement.cs Prints conditional statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​Hashtable.cs Prints hashtable entries.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​FunctionMember.cs Prints class methods.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​FunctionDefinition.cs Prints function declarations.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ForStatement.cs Prints for loops.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ForEachStatement.cs Prints foreach loops.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​FileRedirection.cs Prints file redirection.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ExpandableStringExpression.cs Preserves interpolated strings.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ExitStatement.cs Prints exit statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ErrorStatement.cs Preserves error statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ErrorExpression.cs Preserves error expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​DynamicKeywordStatement.cs Preserves dynamic-keyword statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​DoWhileStatement.cs Prints do-while loops.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​DoUntilStatement.cs Prints do-until loops.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​DataStatement.cs Prints data statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ConvertExpression.cs Prints type conversions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ContinueStatement.cs Prints continue statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ConstantExpression.cs Preserves literal spelling.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ConfigurationDefinition.cs Preserves DSC configuration blocks.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​CommandParameter.cs Prints command parameters.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​CommandExpression.cs Prints expressions with redirection.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​Command.cs Prints commands and continuations.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​CatchClause.cs Prints catch types and bodies.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​BreakStatement.cs Prints break statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​BlockStatement.cs Preserves block statements.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​BaseCtorInvokeMemberExpression.cs Prints base-constructor calls.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​AttributedExpression.cs Prints attributed expressions.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​Attribute.cs Prints attribute arguments.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​AssignmentStatement.cs Prints assignments.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ArrayLiteral.cs Prints comma-separated arrays.
Src/​CSharpier.Core/​PowerShell/​AstPrinters/​ArrayExpression.cs Prints array expressions.
Src/​CSharpier.Core/​PowerShell/​ArgumentList.cs Shares argument-list layout.
Src/​CSharpier.Core/​DocTypes/​StringDoc.cs Reformats factory method.
Src/​CSharpier.Core/​CSharpier.Core.csproj Adds framework-conditional parser dependency.
Src/​CSharpier.Core/​CSharp/​SyntaxPrinter/​Token.cs Reformats comment predicates.
Src/​CSharpier.Core/​CSharp/​SyntaxPrinter/​SyntaxNodePrinters/​TupleExpression.cs Reformats tuple-printer method.
Src/​CSharpier.Core/​CSharp/​CSharpFormatter.cs Reformats forwarding methods.
Src/​CSharpier.Core/​CodeFormatter.cs Dispatches PowerShell formatting.
Src/​CSharpier.Cli/​FormattingEngine.cs Adds PowerShell validation branch.
Src/​CSharpier.Cli/​EditorConfig/​GlobMatcher.cs Reformats existing helpers.
Src/​CSharpier.Cli/​ConsoleLogger.cs Reformats color-selection method.
README.md Lists PowerShell support.
openspec/​changes/​add-powershell-formatting/​proposal.md Records scope and proposed integration.
openspec/​changes/​add-powershell-formatting/​.openspec.yaml Adds change metadata.
docs/​Pre-commit.md Adds PowerShell hook patterns.
docs/​Ignore.md Documents ignore limitations.
docs/​Configuration.md Documents PowerShell configuration.
docs/​CLI.md Documents PowerShell stdin handling.
docs/​About.md Lists PowerShell support.
Directory.Packages.props Pins PowerShell parser dependency.

Review effort: Balanced

Comment on lines +63 to +66
var text = context.GetText(startOffset, node.Extent.EndOffset);
var start = text.IndexOf("${", StringComparison.Ordinal);
var end = start < 0 ? -1 : text.IndexOf('}', start);
return end < 0 || text[..start].Contains('$') ? "$" + node.Name : text[start..(end + 1)];
Comment on lines +17 to +21
foreach (var word in header.Split((char[]?)null, StringSplitOptions.RemoveEmptyEntries))
{
if (word.StartsWith('-'))
{
docs.Add(word.TrimEnd('('));
{
private const int MaxDepth = 200;

private static readonly JsonSerializerOptions IndentedJson = new() { WriteIndented = true };
Doc = result.DocTree,
Errors = result.ErrorDiagnostics.Select(this.ConvertError).ToList(),
SyntaxValidation = await comparer.CompareSourceAsync(CancellationToken.None),
SyntaxValidation = syntaxValidation,
Comment on lines +88 to +89
default:
return value.ToString();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants