Skip to content
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

Don't always disable auto pairs when not before a whitespace #42956

Closed
aeschli opened this issue Feb 5, 2018 · 10 comments
Closed

Don't always disable auto pairs when not before a whitespace #42956

aeschli opened this issue Feb 5, 2018 · 10 comments
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality
Milestone

Comments

@aeschli
Copy link
Contributor

aeschli commented Feb 5, 2018

From #18071 (comment)

When adding a quote after the = in <div class=></div> you will get <div class='> but would rather like to have <div class=''>

Auto-pairs tests whether character after the cursor is a new line or a whitespace. Otherwise it will not insert the pair, just a single quote.
We should extend the language specification to give a list of characters where auto-pairs are enabled. In the case of HTML, for ' and ", that would be >

The example is quite common in HTML when adding attributes to existing elements.

@vscodebot vscodebot bot added editor editor-bracket-matching Editor brace matching labels Feb 5, 2018
@alexdima alexdima added editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality and removed editor-bracket-matching Editor brace matching editor labels Feb 5, 2018
@alexdima alexdima added this to the Backlog milestone Feb 5, 2018
@aeschli
Copy link
Contributor Author

aeschli commented Feb 7, 2018

Other example from #43039
In .html file, you type a tag <div></div>, and type {{ inside of it ... and what you expect is that curly braces will auto-close. But they don't.

They want to auto-close only in situations when there is a space after your caret:

ng - curly braces

@user3323
Copy link

@aeschli

how about parenthesis right before semicolon?..

parenthesis - semicolon

or that's a different case?

@aeschli
Copy link
Contributor Author

aeschli commented Feb 12, 2018

Same issue. The auto pair heuristic currently does not add a closing bracket when the next character is not a whitespace or line end.

@mikerentmeister
Copy link

Please work on this soon, I would really like to see it implemented!

@aeschli
Copy link
Contributor Author

aeschli commented Feb 15, 2018

@rebornix FYI

@user3323
Copy link

@aeschli

when you try to write an arrow function inside of setTimeout, where 1000 ms have written already:

z1

so, the comma does not allow the curly braces to be expanded

@arxpoetica
Copy link

Just ran into this, and, when using mustache style syntax, it can be a real hang up. Is there a way to turn this off across the board? Why should their be a discrepancy?

@JacksonKearl
Copy link
Contributor

JacksonKearl commented Jun 15, 2018

@rebornix What would you think of just delegating the determination of which characters allow matching to the user via settings? I have a branch up here: https://github.com/JacksonKearl/vscode/tree/feature-demo/auto-closing-config that demos this.

This is how it looks if you set
"editor.autoClosingEnabledBefore": " \n\t<>.,;":
(edit: you actually don't need to include characters which are already auto-closing pairs)
afterandbefore

(First run through is with the new setting second is original)

@JacksonKearl
Copy link
Contributor

/duplicate #35197

@vscodebot vscodebot bot added the *duplicate Issue identified as a duplicate of another issue(s) label Jun 19, 2018
@vscodebot
Copy link

vscodebot bot commented Jun 19, 2018

Thanks for creating this issue! We figured it's covering the same as another one we already have. Thus, we closed this one as a duplicate. You can search for existing issues here. See also our issue reporting guidelines.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Jun 19, 2018
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
*duplicate Issue identified as a duplicate of another issue(s) editor-autoclosing Editor automatic closing of parens / brackets / etc. feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

6 participants