Skip to content

Commit

Permalink
Keep property with method
Browse files Browse the repository at this point in the history
closes #1010

# Conflicts:
#	Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test
  • Loading branch information
belav committed Dec 16, 2023
1 parent 6c8bd40 commit a006745
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
var someVariable = someObject
.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);
var someVariable = someObject.Property.CallMethod(
someValue => someValue.SomeProperty == someOtherValue___________________________
);

var someVariable = someObject
.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);

var someVariable = someObject
.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
.Property.CallMethod(
someValue => someValue.SomeProperty == someOtherValue___________________________
)
.CallMethod();

var someVariable = someObject
Expand All @@ -24,8 +25,9 @@ var someVariable = this.Property.CallMethod(
var someVariable = this.Property()
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________);

var someVariable = this.Property
.CallMethod(someValue => someValue.SomeProperty == someOtherValue___________________________)
var someVariable = this.Property.CallMethod(
someValue => someValue.SomeProperty == someOtherValue___________________________
)
.CallMethod();

var someVariable = this.Property()
Expand Down
24 changes: 8 additions & 16 deletions Src/CSharpier.Tests/FormattingTests/TestFiles/cs/MemberChains.test
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ class ClassName
.Where(o => someLongCondition__________________________);

var someValue = someOtherValue!
.Thing!
.Where(o => someLongCondition__________________________)
.Thing!.Where(o => someLongCondition__________________________)
.Where(o => someLongCondition__________________________);

var someValue = someOtherValue
.Thing
.Where(o => someLongCondition__________________________)
.Thing.Where(o => someLongCondition__________________________)
.Where(o => someLongCondition__________________________);

var someValue = someOtherValue
Expand All @@ -84,8 +82,7 @@ class ClassName
);

roleNames
.Value
.Where(o => o.SomeProperty____________________________________)
.Value.Where(o => o.SomeProperty____________________________________)
.Select(o => o.SomethingElse);

return someCondition
Expand Down Expand Up @@ -113,12 +110,9 @@ class ClassName
someParameter____________________________________
)!;

var someVariable = someObject
.Property
.CallMethod(
someValue =>
someValue.SomeProperty == someOtherValue___________________________________
);
var someVariable = someObject.Property.CallMethod(
someValue => someValue.SomeProperty == someOtherValue___________________________________
);

CallMethod(
firstParameter____________________________,
Expand Down Expand Up @@ -238,8 +232,7 @@ class ClassName
.CallMethod__________________();

someThing_______________________
.Property
.CallMethod__________________()
.Property.CallMethod__________________()
.CallMethod__________________();

someThing_______________________
Expand All @@ -248,8 +241,7 @@ class ClassName
.CallMethod__________________();

someThing_______________________
.Property!
.CallMethod__________________()
.Property!.CallMethod__________________()
.CallMethod__________________();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ or ConditionalAccessExpressionSyntax
printedNodes[index].Node
is (
InvocationExpressionSyntax
or MemberAccessExpressionSyntax
or ElementAccessExpressionSyntax
or MemberBindingExpressionSyntax
)
Expand Down

0 comments on commit a006745

Please sign in to comment.