Skip to content

Commit

Permalink
Keep property with method
Browse files Browse the repository at this point in the history
closes #1010
  • Loading branch information
belav committed Dec 16, 2023
1 parent a7d151d commit 50f99f6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 23 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(someValue =>
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
23 changes: 8 additions & 15 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 @@ -83,8 +81,7 @@ class ClassName
);

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

return someCondition
Expand Down Expand Up @@ -112,11 +109,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 @@ -236,8 +231,7 @@ class ClassName
.CallMethod__________________();

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

someThing_______________________
Expand All @@ -246,8 +240,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 50f99f6

Please sign in to comment.