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

Dealing with an edge case for conditional access #640

Merged
merged 2 commits into from
Apr 7, 2022
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
Expand Up @@ -234,5 +234,13 @@ class ClassName
longParameter_______________________________________
)
.CallMethod__________________();

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

someThing_______________________?.Property
.CallMethod__________________()
.CallMethod__________________();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,23 @@ List<PrintedNode> printedNodes
{
for (; index + 1 < printedNodes.Count; ++index)
{
/* this handles the special case where we want ?.Property on the same line
someThing_______________________?.Property
.CallMethod__________________()
.CallMethod__________________();
*/
if (
printedNodes[index].Node is ConditionalAccessExpressionSyntax
&& printedNodes[index + 1].Node
is MemberBindingExpressionSyntax { Parent: MemberAccessExpressionSyntax }
)
{
currentGroup.Add(printedNodes[index]);
currentGroup.Add(printedNodes[index + 1]);
index++;
continue;
}

if (
(
IsMemberish(printedNodes[index].Node)
Expand Down