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

JSX/HTML tag auto-close feature #5267

Closed
1 task done
rranjan14 opened this issue Jul 27, 2022 · 32 comments · Fixed by #11761
Closed
1 task done

JSX/HTML tag auto-close feature #5267

rranjan14 opened this issue Jul 27, 2022 · 32 comments · Fixed by #11761
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] html HTML markup support javascript JavaScript programming language support

Comments

@rranjan14
Copy link

Check for existing issues

  • Completed

Is your feature request related to a problem?

It's a bit frustrating to add the close tag at the end of the jsx element or html element. So, having that auto-close tag functionality will definitely help there.

Describe the solution you'd like

Something like the vscode setting for auto-close tag feature. As soon as you type the opening of the tag, the end of the tag comes as well.

If applicable, add mockups / screenshots to help present your vision of the feature

No response

@rranjan14 rranjan14 added enhancement [core label] triage Maintainer needs to classify the issue labels Jul 27, 2022
@JosephTLyons JosephTLyons added editor Feedback for code editing, formatting, editor iterations, etc and removed triage Maintainer needs to classify the issue labels Jul 28, 2022
@JosephTLyons JosephTLyons added javascript JavaScript programming language support html HTML markup support labels Aug 23, 2022
@mikayla-maki mikayla-maki mentioned this issue Dec 4, 2022
48 tasks
@JosephTLyons JosephTLyons transferred this issue from zed-industries/community Jan 24, 2024
@emersonjds
Copy link

+1 This is something so standard that it's even strange to program it without auto-closing tags

I hope they improve this because it helps a lot with the developer experience

Thanks for u work Zed team !

@jlarmstrongiv
Copy link

Astro support was added recently 🎉 and would also greatly benefit from auto closing tags

@3ux1n3
Copy link

3ux1n3 commented Mar 7, 2024

this is the only reason why i didn't 100% switch to zed , when will this come ? or is it already possible yet?

@ElectricS01
Copy link

This would also be good in .vue files

@feldrok
Copy link

feldrok commented Mar 19, 2024

We need this please, it makes the developer experience so smooth. It feels weird not having it.

@KoHorizon
Copy link

Yes, i agree this is important for anyone doing web development. i'll wait a bit until it's there, or i'll look into fixing it myself.

@abiliocoelho
Copy link

It would help a lot with productivity, I think it’s very important

@widersky widersky mentioned this issue Apr 2, 2024
1 task
@sinao-dev
Copy link

is there any progress here? this small feature will make my life so much easier

@Moshyfawn
Copy link
Member

I'm going to repost what I've already said on Twitter for the sake of transparency:

I get it 💯 It's definitely on the radar, but right now efforts are focused on APIs that would allow some work to be offloaded to the community to handle some of the use cases via extensions as well as larger feature parity items.

But rest assured, it's not being kicked down the road and will come later, and there's a possibility that someone from the community will pick it up.

@monarcode
Copy link

This is the main reason I have not switched to Zed fully yet

osiewicz added a commit that referenced this issue May 20, 2024
Fixes #5267 
TODO:
- [x] Publish our fork of vscode-langservers-extracted on GH and wire
that through as a language server of choice for HTML extension.
- [x] Figure out how to prevent edits made by remote participants from
moving the cursor of a host.

Release Notes:

- Added support for autoclosing of HTML tags in local projects.
@chungweileong94
Copy link
Contributor

For some reason, this feature doesn't really work on Zed Preview 0.137.0.

@rendaoer
Copy link

Does not work in jsx/tsx

@Moshyfawn
Copy link
Member

Does not work in jsx/tsx

Only HTML support has just landed. Be sure to +👍 this other issue for JSX / TSX support.

@joaopcm
Copy link

joaopcm commented Jun 20, 2024

Should it be working in TSX files?

@monarcode
Copy link

I think it should for react based files/projects

@Haume0
Copy link

Haume0 commented Jul 6, 2024

it's not working on jsx/tsx

Nextjs project app router typescript

@Kechenk
Copy link

Kechenk commented Aug 12, 2024

it's not working too with blade.php

will be waiting on this 👍🏾

@rsmidt
Copy link

rsmidt commented Aug 19, 2024

Also does not work for .heex files.

@AnasMaimalee
Copy link

It does not work with .vue files

@qaynam
Copy link

qaynam commented Aug 30, 2024

it dose not work with .svelte file

@Haume0
Copy link

Haume0 commented Sep 1, 2024

.astro not working

@Pyr33x
Copy link

Pyr33x commented Sep 18, 2024

Please fix supporting for TSX/JSX so I can fully migrate from VSCode to Zed

@glenmiracle18
Copy link

Please fix supporting for TSX/JSX so I can fully migrate from VSCOde to Zed

same here

@JonathanMessina-IPG
Copy link

JonathanMessina-IPG commented Oct 27, 2024

Please implement this, not having it practically leaves out every front end developer.

@monarcode
Copy link

I have given up on Zed because of this

The team seems more interested in AI and adding vim features than "minor issues" like these

The fact that basic stuff like formatting in snippets, tag autorename / auto close, is not working for months with 0 word to even give users hope is just disheartening

It's a great editor, but if you can't get even the most essentials to work, then what's the point

@igmtdev
Copy link

igmtdev commented Oct 27, 2024

is not working in tsx 🥺

@eljonathas
Copy link

add suport to jsx 🙏

@Xorgentur
Copy link

Within ./zed/snippets/tsx.json you can define custom snippets. For example, configuring a snippet such that typing div expands into paired <div> tags with the cursor positioned between them. Would this be sufficient for you?

{
  "Log to the console": {
    "prefix": "clg",
    "body": ["console.log($1);", "$0"],
    "description": "Log to the console"
  },
  "Add div": {
    "prefix": "div",
    "body": ["<div>$1</div>", "$0"],
    "description": "Add div"
  },
  "Add p": {
    "prefix": "p",
    "body": ["<p>$1</p>", "$0"],
    "description": "Add p"
  },
  "Add span": {
    "prefix": "span",
    "body": ["<span>$1</span>", "$0"],
    "description": "Add span"
  },
  "Add a": {
    "prefix": "href",
    "body": ["<a href=\"$1\">$2</a>", "$0"],
    "description": "Add a"
  }
}

@monarcode
Copy link

Within ./zed/snippets/tsx.json you can define custom snippets. For example, configuring a snippet such that typing div expands into paired <div> tags with the cursor positioned between them. Would this be sufficient for you?


{

  "Log to the console": {

    "prefix": "clg",

    "body": ["console.log($1);", "$0"],

    "description": "Log to the console"

  },

  "Add div": {

    "prefix": "div",

    "body": ["<div>$1</div>", "$0"],

    "description": "Add div"

  },

  "Add p": {

    "prefix": "p",

    "body": ["<p>$1</p>", "$0"],

    "description": "Add p"

  },

  "Add span": {

    "prefix": "span",

    "body": ["<span>$1</span>", "$0"],

    "description": "Add span"

  },

  "Add a": {

    "prefix": "href",

    "body": ["<a href=\"$1\">$2</a>", "$0"],

    "description": "Add a"

  }

}

Well this definitely helps, but it only solves half the problem.. what of custom tags? What of none self-closing components, having to create snippets but every possible use case won't cut it

@Pyr33x
Copy link

Pyr33x commented Dec 30, 2024

Within ./zed/snippets/tsx.json you can define custom snippets. For example, configuring a snippet such that typing div expands into paired <div> tags with the cursor positioned between them. Would this be sufficient for you?

{
  "Log to the console": {
    "prefix": "clg",
    "body": ["console.log($1);", "$0"],
    "description": "Log to the console"
  },
  "Add div": {
    "prefix": "div",
    "body": ["<div>$1</div>", "$0"],
    "description": "Add div"
  },
  "Add p": {
    "prefix": "p",
    "body": ["<p>$1</p>", "$0"],
    "description": "Add p"
  },
  "Add span": {
    "prefix": "span",
    "body": ["<span>$1</span>", "$0"],
    "description": "Add span"
  },
  "Add a": {
    "prefix": "href",
    "body": ["<a href=\"$1\">$2</a>", "$0"],
    "description": "Add a"
  }
}

Thank you for sharing this! However, this is still quite far from solving the problem. If we have a table or any other tags, should we really make this a lengthy configuration? Or what if we had components?

@3ux1n3
Copy link

3ux1n3 commented Dec 31, 2024

install the emmet extention it works fine for me on tsx and jsx files

@monarcode
Copy link

@3ux1n3 omg, thanks, that actually works!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor Feedback for code editing, formatting, editor iterations, etc enhancement [core label] html HTML markup support javascript JavaScript programming language support
Projects
None yet
Development

Successfully merging a pull request may close this issue.