Skip to content

Commit 82f6315

Browse files
committed
Check line length
1 parent 81abd4b commit 82f6315

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/New/CSharpFormattingPass.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,8 @@ public async Task<ImmutableArray<TextChange>> ExecuteAsync(FormattingContext con
147147
// If the next line is a brace, we skip it, otherwise we don't. This is used to skip the opening brace of a class
148148
// that we insert, but Roslyn settings might place on the same like as the class declaration.
149149
if (iFormatted + 1 < formattedCSharpText.Lines.Count &&
150-
formattedCSharpText.Lines[iFormatted + 1].CharAt(0) == '{')
150+
formattedCSharpText.Lines[iFormatted + 1] is { Span.Length: > 0 } nextLine &&
151+
nextLine.CharAt(0) == '{')
151152
{
152153
iFormatted++;
153154
}

0 commit comments

Comments
 (0)