-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Allow brace completion in comments #12741
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
Conversation
Hi @anubmat, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
TTYL, MSBOT; |
@jramsay , @paulvanbrenk , @billti , @vlad, Can someone please review? |
@@ -1725,7 +1725,7 @@ namespace ts { | |||
const sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName); | |||
|
|||
// Check if in a context where we don't want to perform any insertion | |||
if (isInString(sourceFile, position) || isInComment(sourceFile, position)) { |
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.
This should only be the case for {
not for all braces. IMO
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.
Doesn't work for <>. But why should it exclude () and []?
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.
What does C# do?
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.
c# does no completions for any type of braces inside comments..
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.
c# is smart, otherwise too outside comments, it only completes when brackets are placed in an expected location
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.
Ok, Don't have a strong opinion either way..
How does this behave in the editor? If we auto-complete the closing brace, (so after typing the opening brace the cursor is at |
The behavior is same as outside comments, i.e. on typing the closing brace, it moves past the auto-inserted one and does not add an additional closing brace, like that |
Great, thanks. If you've tried it out in VS and VS Code and the experience feels right, then 👍 :-) |
I tried and it works nicely in VS. As for VsCode, brace completion was already working inside comments. |
Allows brace completion inside comments in JS and TS files