question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:28
  • Comments:16 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
aityahiaidircommented, Jan 11, 2021

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

4reactions
VadimGorbenkocommented, Sep 12, 2019

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Method to change self-closing tags to explicit tags in Javascript?
try this to replace all self closing tags out of your string (xml/html) function removeSelfClosingTags(xml) { var split = xml.split("/>"); var newXml =...
Read more >
HTML - How do I stop tags from auto closing like this ... - Reddit
Do you have an extension installed that auto closes? I use 'Auto Close Tag'. Disabling such an extension should work.
Read more >
Remove all references to "self-closing" void elements in core
character. This character has no effect on void elements, but on foreign elements it marks the start tag as self-closing.
Read more >
auto-delete closing tag - Visual Studio Feedback
“auto-delete closing tag” is triggered when editing XAML comments. Example: From this. <TextBlock Margin=“0 6” Text=“{Binding Text, Mode=OneWay}” ...
Read more >
replacing self closing tag - MSDN - Microsoft
How to replace < AdditionalEmail/> self closing tag to empty tag while converting query data to xml in the below query.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found