[html] Automatically delete HTML closing tag when converting to self-closing tag
See original GitHub issueA 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:
- Created 5 years ago
- Reactions:28
- Comments:16 (1 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello, there is any news since time on implementation of this feature ?
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"/>