Skip to content

Commit

Permalink
Better breaking for generic object creation expressions with no argum…
Browse files Browse the repository at this point in the history
…ents or initliazer (#589)

closes #578

Co-authored-by: Lasath Fernando <devel@lasath.org>
  • Loading branch information
belav and shocklateboy92 authored Feb 6, 2022
1 parent cf43c06 commit c7b1371
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,26 @@ public class ClassName

public System.Text.StringBuilder NamespacedField;

public static Dictionary<Type, string> PropertiesByType = new Dictionary<
SomeLongTypeName,
string
>();
public Dictionary<SomeType__________________, SomeType___________________> Property =
new Dictionary<SomeType__________________, SomeType__________________>();

public Dictionary<SomeType_________, SomeType_________> Property =
new Dictionary<SomeType_________, SomeType_________>();

public static Dictionary<
SomeLongTypeName,
SomeOtherLongTypeName_______________________________
> PropertiesByType = new Dictionary<
SomeLongTypeName,
SomeOtherLongTypeName_______________,
SomeOtherLongTypeName_______________
> PropertiesByType =
new Dictionary<SomeOtherLongTypeName____________, SomeOtherLongTypeName____________>();

public static Dictionary<
SomeOtherLongTypeName_______________________________,
SomeOtherLongTypeName_______________________________
>();
> PropertiesByType =
new Dictionary<
SomeOtherLongTypeName_______________________________,
SomeOtherLongTypeName_______________________________
>();

private static readonly Func<SyntaxTrivia, bool> s_isVisualBasicCommentTrivia = (
syntaxTrivia
Expand Down
12 changes: 11 additions & 1 deletion Src/CSharpier/SyntaxPrinter/RightHandSide.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,17 @@ or ArrowExpressionClauseSyntax
}

if (
!isTail && rightNode is AssignmentExpressionSyntax { Right: AssignmentExpressionSyntax }
(
!isTail
&& rightNode is AssignmentExpressionSyntax { Right: AssignmentExpressionSyntax }
)
|| rightNode
is ObjectCreationExpressionSyntax
{
Type: GenericNameSyntax,
ArgumentList: { Arguments: { Count: 0 } },
Initializer: null
}
)
{
return Layout.BreakAfterOperator;
Expand Down

0 comments on commit c7b1371

Please sign in to comment.