Skip to content

Commit c6025ad

Browse files
authored
Fixing issue with raw strings inside query expression inside parens (#1621)
closes #1617
1 parent c4dbc08 commit c6025ad

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

Src/CSharpier.Core/CSharp/SyntaxPrinter/SyntaxNodePrinters/InvocationExpression.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,10 @@ is ArrayCreationExpressionSyntax
111111
or ObjectCreationExpressionSyntax { Initializer: not null }
112112
)
113113
|| groups[0].First().Node
114-
is ParenthesizedExpressionSyntax { Expression: SwitchExpressionSyntax }
114+
is ParenthesizedExpressionSyntax
115+
{
116+
Expression: SwitchExpressionSyntax or QueryExpressionSyntax
117+
}
115118
|| (
116119
parent is ExpressionStatementSyntax expressionStatementSyntax
117120
&& expressionStatementSyntax.SemicolonToken.LeadingTrivia.Any(o => o.IsComment())

Src/CSharpier.Tests/FormattingTests/TestFiles/cs/QueryExpressions.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,5 +98,18 @@ class ClassName
9898
let i2 = i * i
9999
where i2 < 100
100100
select new { Square = i2, Root = i };
101+
102+
(
103+
from x in SomeMethod()
104+
select """
105+
someString
106+
"""
107+
)
108+
.CallMethod_____________________________________________()
109+
.CallMethod_____________________________________________();
110+
111+
(from x in SomeMethod() select "someString")
112+
.CallMethod_____________________________________________()
113+
.CallMethod_____________________________________________();
101114
}
102115
}

0 commit comments

Comments
 (0)