Skip to content

Commit

Permalink
Add line when await precedes query expression (#741)
Browse files Browse the repository at this point in the history
* Add line when await precedes query expression.

* Formatting.
  • Loading branch information
domn1995 authored Oct 24, 2022
1 parent 4aabbf0 commit 509862c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -63,5 +63,11 @@ class ClassName
Country________________________ = g.Key,
CustCount____________________________ = g.Count()
};

var asyncQuery = await
from c in customers
from u in users
from res in HandleAsync(c, u)
select res;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@ internal static class AwaitExpression
{
public static Doc Print(AwaitExpressionSyntax node, FormattingContext context)
{
var precedesQueryExpression = node.Expression is QueryExpressionSyntax;

return Doc.Concat(
Token.PrintWithSuffix(node.AwaitKeyword, " ", context),
Node.Print(node.Expression, context)
precedesQueryExpression
? Doc.Indent(Doc.Line, Node.Print(node.Expression, context))
: Node.Print(node.Expression, context)
);
}
}

0 comments on commit 509862c

Please sign in to comment.