From 3aeb571bed2cf739f98e4bb850042eff7c3ec53e Mon Sep 17 00:00:00 2001 From: Bela VanderVoort Date: Tue, 10 Oct 2023 08:28:27 -0500 Subject: [PATCH] Formatting struct primary constructor (#971) closes #969 --- .../FormattingTests/TestFiles/cs/StructDeclarations.test | 9 +++++++++ .../SyntaxNodePrinters/BaseTypeDeclaration.cs | 1 + 2 files changed, 10 insertions(+) diff --git a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/StructDeclarations.test b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/StructDeclarations.test index afc2499d6..7a2d25180 100644 --- a/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/StructDeclarations.test +++ b/Src/CSharpier.Tests/FormattingTests/TestFiles/cs/StructDeclarations.test @@ -1,3 +1,12 @@ struct BasicStruct { } public readonly struct ReadonlyStruct { } + +public struct NamedItem2( + string name1________________________________, + string name2________________________________ +) +{ + public string Name1 => name1; + public string Name2 => name1; +} diff --git a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/BaseTypeDeclaration.cs b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/BaseTypeDeclaration.cs index 95285d43d..74692d014 100644 --- a/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/BaseTypeDeclaration.cs +++ b/Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/BaseTypeDeclaration.cs @@ -35,6 +35,7 @@ public static Doc Print(BaseTypeDeclarationSyntax node, FormattingContext contex else if (node is StructDeclarationSyntax structDeclarationSyntax) { keyword = structDeclarationSyntax.Keyword; + parameterList = structDeclarationSyntax.ParameterList; } else if (node is InterfaceDeclarationSyntax interfaceDeclarationSyntax) {