Skip to content

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

Merged
merged 2 commits into from
Dec 8, 2016
Merged

Conversation

anubmat
Copy link
Contributor

@anubmat anubmat commented Dec 8, 2016

Allows brace completion inside comments in JS and TS files

@msftclas
Copy link

msftclas commented Dec 8, 2016

Hi @anubmat, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!


It looks like you're a Microsoft contributor (Anubha Mathur). If you're full-time, we DON'T require a Contribution License Agreement. If you are a vendor, please DO sign the electronic Contribution License Agreement. It will take 2 minutes and there's no faxing! https://cla.microsoft.com.

TTYL, MSBOT;

@anubmat
Copy link
Contributor Author

anubmat commented Dec 8, 2016

@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)) {
Copy link
Contributor

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

Copy link
Contributor Author

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 []?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does C# do?

Copy link
Contributor Author

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..

Copy link
Contributor Author

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

Copy link
Contributor

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..

@DanielRosenwasser DanielRosenwasser changed the title Allow bracket completion in comments Allow brace completion in comments Dec 8, 2016
@billti
Copy link
Member

billti commented Dec 8, 2016

How does this behave in the editor? If we auto-complete the closing brace, (so after typing the opening brace the cursor is at ( | ) ), then when I type a closing brace, does it automatically just move me past the auto-inserted one, and not add an additional closing brace (i.e. I should end up with ( ) |, not ( ) | ) ).

@anubmat
Copy link
Contributor Author

anubmat commented Dec 8, 2016

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 ( ) |

@billti
Copy link
Member

billti commented Dec 8, 2016

Great, thanks. If you've tried it out in VS and VS Code and the experience feels right, then 👍 :-)

@anubmat
Copy link
Contributor Author

anubmat commented Dec 8, 2016

I tried and it works nicely in VS. As for VsCode, brace completion was already working inside comments.

@anubmat anubmat merged commit 9dd769d into master Dec 8, 2016
@anubmat anubmat deleted the allowBracketCompletionInComments branch December 8, 2016 22:37
@mhegazy mhegazy mentioned this pull request Dec 12, 2016
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants