Skip to content

Automatically add braces or quotations after JSX attributes #44563

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

Closed
allan2 opened this issue May 25, 2021 · 3 comments
Closed

Automatically add braces or quotations after JSX attributes #44563

allan2 opened this issue May 25, 2021 · 3 comments
Labels
Duplicate An existing issue was already created

Comments

@allan2
Copy link

allan2 commented May 25, 2021

For .jsx or .tsx files, WebStorm has a nice feature that automatically adds braces or quotations after JSX attributes. It's on by default too.

Since all attributes accept either string literals expressions in curly braces, this would help a lot of people.

This is how it would work:

// type this
<div className=

// get either this
<div className={}
               ^^ cursor is nicely between the braces

// or get this
<div className=""
               ^^ cursor is nicely between the quotes

In case it comes up, this issue is different from microsoft/vscode#35197. That issue was about auto-completing the braces after typing the opening brace.
This one is about automatically inserting both braces (or quotes).

It would be nice to have the option of quotation marks or braces. I expect most people would want braces so that should be the default.

The setting in WebStorm:

Blog posts on it:
Under "Configurable code completion for JSX attributes" https://blog.jetbrains.com/webstorm/2017/12/webstorm-2017-3-1/

@mjbvz mjbvz transferred this issue from microsoft/vscode Jun 12, 2021
@mjbvz mjbvz removed their assignment Jun 12, 2021
@mjbvz
Copy link
Contributor

mjbvz commented Jun 12, 2021

Another possible use case of #25207

@RyanCavanaugh RyanCavanaugh added Experience Enhancement Noncontroversial enhancements Suggestion An idea for TypeScript labels Jun 14, 2021
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Jun 14, 2021
@RyanCavanaugh
Copy link
Member

@mjbvz happy to prioritize this one, maybe for 4.5? It'd be nice

@andrewbranch
Copy link
Member

Duplicate of #38891 — tracking there.

@andrewbranch andrewbranch added Duplicate An existing issue was already created and removed Suggestion An idea for TypeScript Experience Enhancement Noncontroversial enhancements labels Aug 26, 2021
@andrewbranch andrewbranch removed this from the Backlog milestone Aug 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants