Skip to content

Commit 2f6094c

Browse files
authored
Fixing inconsistent indentation with parenthisized expression (#1570)
closes #1562
1 parent 6cba47f commit 2f6094c

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Shell/ReviewBranch.psm1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,9 @@ function CSH-ReviewBranch {
5353
$postBranchOutput = (git status 2>&1) | Out-String
5454
$firstRun = -not $postBranchOutput.Contains("On branch $postBranch")
5555

56-
$skipValidation = ""
56+
$skipValidationParam = ""
5757
if ($skipValidation -eq $true) {
58-
$skipValidation = "--skip-validation"
58+
$skipValidationParam = "--skip-validation"
5959
}
6060

6161
if ($firstRun) {
@@ -76,11 +76,11 @@ function CSH-ReviewBranch {
7676
& git reset --hard
7777
& git checkout -b $preBranch
7878

79-
dotnet $csharpierDllPath . $fastParam --no-cache
79+
dotnet $csharpierDllPath format . $skipValidationParam --no-cache
8080
# there is some weirdness with a couple files with #if where
8181
# they need to be formatted twice to get them stable
8282
# it isn't worth fixing in csharpier, because it only really affects this
83-
dotnet $csharpierDllPath . $fastParam
83+
dotnet $csharpierDllPath format . $skipValidationParam
8484

8585
& git add -A
8686
& git commit -m "Before $branch"
@@ -99,7 +99,7 @@ function CSH-ReviewBranch {
9999
& git checkout $postBranch
100100
}
101101

102-
dotnet $csharpierDllPath . $fastParam --no-cache
102+
dotnet $csharpierDllPath format . $skipValidationParam --no-cache
103103

104104
& git add -A
105105
& git commit -m "After $branch"

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,11 @@ class ClassName
1212
|| currentChar == '|'
1313
|| currentChar == '&'
1414
);
15+
var b2 = (
16+
System.Environment.SpecialFolder.AdminTools
17+
is System.Environment.SpecialFolder.AdminTools
18+
or System.Environment.SpecialFolder.AdminTools
19+
or System.Environment.SpecialFolder.AdminTools
20+
);
1521
}
1622
}

Src/CSharpier/SyntaxPrinter/SyntaxNodePrinters/IsPatternExpression.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ internal static class IsPatternExpression
44
{
55
public static Doc Print(IsPatternExpressionSyntax node, PrintingContext context)
66
{
7-
if (node.Parent is not (IfStatementSyntax or ParenthesizedExpressionSyntax))
7+
if (
8+
node.Parent
9+
is not (IfStatementSyntax or ParenthesizedExpressionSyntax)
10+
or ParenthesizedExpressionSyntax { Parent: EqualsValueClauseSyntax }
11+
)
812
{
913
return Doc.Group(
1014
Node.Print(node.Expression, context),

0 commit comments

Comments
 (0)