Skip to content

Commit

Permalink
Update ParenthesisBraceCompletionService.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Apr 3, 2021
1 parent 6fdccd1 commit 6ab85a2
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ protected override async Task<bool> IsValidOpenBraceTokenAtPositionAsync(SyntaxT
}

// now check whether parser think whether there is already counterpart closing parenthesis
var (openBrace, closeBrace) = token.Parent.GetParentheses();
var (openParen, closeParen) = token.Parent.GetParentheses();

// We can complete the brace if the closing brace is missing or the incorrect kind.
if (closeBrace.Kind() != SyntaxKind.CloseParenToken || closeBrace.Span.Length == 0)
if (closeParen.Kind() != SyntaxKind.CloseParenToken || closeParen.Span.Length == 0)
{
return true;
}
Expand All @@ -58,7 +58,7 @@ protected override async Task<bool> IsValidOpenBraceTokenAtPositionAsync(SyntaxT
// brace completion session higher up on the stack. If that's the case then we can
// complete the opening brace here, so return this as valid for completion.
var text = await document.GetTextAsync(cancellationToken).ConfigureAwait(false);
return text.Lines.GetLineFromPosition(openBrace.SpanStart).LineNumber == text.Lines.GetLineFromPosition(closeBrace.Span.End).LineNumber;
return text.Lines.GetLineFromPosition(openParen.SpanStart).LineNumber == text.Lines.GetLineFromPosition(closeParen.Span.End).LineNumber;
}
}
}

0 comments on commit 6ab85a2

Please sign in to comment.