microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.31k stars 28.9k forks source link

[html] Automatically delete HTML closing tag when converting to self-closing tag #58315

Open hb20007 opened 6 years ago

hb20007 commented 6 years ago

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.

vscodebot[bot] commented 6 years ago

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

clocky commented 5 years ago

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

hb20007 commented 5 years ago

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

vscode v1 30 2

TanelVari commented 5 years ago

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

VadimGorbenko commented 5 years ago

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"/>

faisal6621 commented 4 years ago

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
Lagily commented 4 years ago

would be great to get this!

tsachit commented 4 years ago

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.

matrixcloud commented 3 years ago

Would be great to get this.

aityahiaidir commented 3 years ago

Hello, there is any news since time on implementation of this feature ?

kirkbross commented 3 years ago

I'm running Visual Studio Code -- what does (user setup) mean?

Version: 1.54.1 (user setup)
Commit: f30a9b73e8ffc278e71575118b6bf568f04587c8
Date: 2021-03-04T22:38:31.419Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Windows_NT x64 10.0.18363

Like many above, closing tags do not get removed if you convert the opening tag to a self-closing tag.

Do I need to do something or is this not implemented yet?

TargiX commented 3 years ago

Please can you make this implemented, it really affects everyday code typing experience

ManuRodgers commented 2 years ago

is this issue solved?

hb20007 commented 2 years ago

No

HeSingh93 commented 1 year ago

Has this issue been resolved?

hb20007 commented 1 year ago

No