Skip to content

Commit

Permalink
Handling more edge cases
Browse files Browse the repository at this point in the history
  • Loading branch information
belav committed Oct 11, 2021
1 parent 443fa64 commit 1bb7377
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,33 @@ class ClassName
secondParameter___________________________
);

this.CallMethod(
firstParameter____________________________,
secondParameter___________________________
)
.CallMethod(
firstParameter____________________________,
secondParameter___________________________
);

string.CallMethod(
firstParameter____________________________,
secondParameter___________________________
)
.CallMethod(
firstParameter____________________________,
secondParameter___________________________
);

o.CallMethod(
firstParameter____________________________,
secondParameter___________________________
)
.CallMethod(
firstParameter____________________________,
secondParameter___________________________
);

SomeObject?
.CallMethod(parameter_______________________________________________________________)
.ToArray();
Expand Down
13 changes: 12 additions & 1 deletion Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/ArgumentList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ namespace CSharpier.SyntaxPrinter.SyntaxNodePrinters
{
public static class ArgumentList
{
// TODO I think this indent logic can move into the FlattenAndPrintNodes method
// then hopefully it can share it with ShouldMergeFirstTwoGroups
public static Doc Print(ArgumentListSyntax node)
{
return Doc.Group(
Expand All @@ -13,7 +15,16 @@ public static Doc Print(ArgumentListSyntax node)
node.Parent
is InvocationExpressionSyntax
{
Expression: IdentifierNameSyntax,
Expression: IdentifierNameSyntax
or MemberAccessExpressionSyntax
{
Expression: ThisExpressionSyntax
or PredefinedTypeSyntax
or IdentifierNameSyntax
{
Identifier: { Text: { Length: <= 4 } }
}
},
Parent: { Parent: InvocationExpressionSyntax }
},
ArgumentListLike.Print(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -566,37 +566,6 @@ context.Operation is IInvocationOperation invocation
TestProjectName,
LanguageNames.CSharp
);
// maybe things < 4 should merge? looks super bad when it is a single character
// but what about when they are on something like
var someLongName = cfg.CallMethod()
.CallMethod()o
new MapperConfiguration(
cfg =>
{
cfg
.CreateProjection<Source, Destination>()
.IncludeMembers(
s => s.InnerSources.FirstOrDefault(),
s => s.OtherInnerSources.FirstOrDefault()
);
cfg
.CreateProjection<InnerSource, Destination>(MemberList.None)
.ForMember(
d => d.Details,
o => o.MapFrom(s => s.InnerSourceDetails.FirstOrDefault())
);
cfg
.CreateProjection<OtherInnerSource, Destination>(MemberList.None)
.ForMember(
d => d.OtherDetails,
o => o.MapFrom(s => s.OtherInnerSourceDetails.FirstOrDefault())
);
cfg.CreateProjection<InnerSourceDetails, DestinationDetails>();
cfg.CreateProjection<OtherInnerSourceDetails, OtherDestinationDetails>();
}
);
}
}
Expand Down

0 comments on commit 1bb7377

Please sign in to comment.