Skip to content

Commit

Permalink
Format record braces consistently with class (#313)
Browse files Browse the repository at this point in the history
* Format record braces consistently with class

closes #233

* introduce variable to make code easier to understand
  • Loading branch information
belav authored Jun 19, 2021
1 parent d8956d7 commit 4c179a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ record MostlyWeeklyTemperature(

record PC(string x) : PrimaryConstructor(x) { }

public record RecordWithProperty
{
public string Property { get; set; }
}

record RecordWithoutBody(string property);

record LongerRecordNameWhatHappens_________________________________________(string x)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,11 @@ public static Doc Print(BaseTypeDeclarationSyntax node)
{
DocUtilities.RemoveInitialDoubleHardLine(members);

var useSpaceBraceWithParameterList = groupId != null && parameterList != null;
docs.Add(
groupId != null ? Doc.IfBreak(" ", Doc.Line, groupId) : Doc.HardLine,
useSpaceBraceWithParameterList
? Doc.IfBreak(" ", Doc.Line, groupId)
: Doc.HardLine,
Token.Print(node.OpenBraceToken),
members,
Doc.HardLine,
Expand Down

0 comments on commit 4c179a1

Please sign in to comment.