-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Address cases where brace matching wasn't working for string quotes. #72233
Address cases where brace matching wasn't working for string quotes. #72233
Conversation
src/EditorFeatures/CSharpTest/AutomaticCompletion/AutomaticLiteralCompletionTests.cs
Show resolved
Hide resolved
if (token.Kind() is not SyntaxKind.InterpolatedStringStartToken and | ||
not SyntaxKind.InterpolatedVerbatimStringStartToken and | ||
not SyntaxKind.StringLiteralToken and | ||
not SyntaxKind.IdentifierToken) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prior logic was too much syntax tree based. this made it fall over when the tree wasn't well formed (like just having a naked $
in an expression).
The fix is to smartly moved before those characters. We then know we must have a string (since we have a $
and we know the user is typing "
). We then use the existing helpers to then ask "is this a legal place for such a string".
Importantly, we're only looking at the tree prior to the current token we're writing. we're not trying to examine the in-progress token itself directly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest manually verifying that this does not interfere with typing an interpolated raw string in the editor.
src/Features/CSharp/Portable/BraceCompletion/InterpolatedStringBraceCompletionService.cs
Outdated
Show resolved
Hide resolved
Fixes #62571 if I understand this correctly |
…gBraceCompletionService.cs Co-authored-by: Sam Harwell <[email protected]>
Have done so. |
Fixes #62571