Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep property with method #1074

Merged
merged 1 commit into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading