Vscode: [html] Automatically delete HTML closing tag when converting to self-closing tag

Created on 9 Sep 2018  路  11Comments  路  Source: microsoft/vscode

A simple but useful feature would be to automatically delete an HTML or a JSX closing tag when converting to a self-closing tag.

In the latest version of VS Code (1.27.1), in order to go from

<App><App>

to

<App />

,

I need to do the following:

<App /></App>

and then manually delete the closing tag. It would be great if, at this point, VS Code would do that automatically.

I think it's simple enough and would be a nice feature especially for web developers who use Emmet. Therefore, it could be a core feature.

I tried searching for an extension that does this, but I was not able to find any. If an extension already exists, please link it here.

This is not a duplicate of any of the issues linked by the experimental duplicate detection.

feature-request html

Most helpful comment

@hb20007, @clocky meant the full Visual Studio, not VS Code. This request still stays

All 11 comments

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

As noted by @TanelVari, Visual Studio for Windows has the expected behaviour in this instance; the automatically added closing tag gets removed when the opening tag is updated into an self-closing tag:

kapture 2019-01-23 at 16 55 47

@clocky @TanelVari This does not work in the latest version of VS Code for Windows (v1.30.2)

vscode v1 30 2

@hb20007, @clocky meant the full Visual Studio, not VS Code. This request still stays

It will be good if it will work.
For now, you can just add / in the end of your tag.
Example:
App + tab expanded to <App></App>
App/ + tab expanded to <App/>
App[test=test]/ + tab expanded to <App test="test"/>

Strange, why this issue has not been taken into account? I am also facing the same issue.
This issue is not a duplicate as emphasized by @hb20007

Version: 1.41.1
Commit: 26076a4de974ead31f97692a0d32f90d735645c0
Date: 2019-12-18T15:04:31.999Z
Electron: 6.1.5
Chrome: 76.0.3809.146
Node.js: 12.4.0
V8: 7.6.303.31-electron.0
OS: Linux x64 5.3.0-26-generic

would be great to get this!

It will be good if it will work.
For now, you can just add / in the end of your tag.
Example:
App + tab expanded to <App></App>
App/ + tab expanded to <App/>
App[test=test]/ + tab expanded to <App test="test"/>

Thanks, it's been a while I didn't use this feature and I looking for changes, because this use to work before. Guess they made changes to explicitly define the type of tag.

Would be great to get this.


This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!


:slightly_smiling_face: This feature request received a sufficient number of community upvotes and we moved it to our backlog. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

trstringer picture trstringer  路  3Comments

biij5698 picture biij5698  路  3Comments

philipgiuliani picture philipgiuliani  路  3Comments

sijad picture sijad  路  3Comments

shanalikhan picture shanalikhan  路  3Comments