Reputation: 2683
According to this update, VS Code is supposed to auto close tags when the closing >
of the opening tag is typed. Mine won't seem to do that (I'm on v1.19).
I also tried installing the package Jun Han made which is supposed to do this too, but it doesn't work. Is there a trick to getting this function to work?
Enabled extensions are:
Upvotes: 3
Views: 7198
Reputation: 1388
I had the same problem. After reviewing the answer above, I noticed that VS Code auto-detected a different language than HTML, even though the file I was editing had the ".html" extension. After selecting HTML as the working language, the editor now auto-closes the tags.
Upvotes: 0
Reputation: 29608
I've also experienced inconsistencies with this feature.
Tag elements are now automatically closed when > of the opening tag is typed
This only seems to work when the file is detected as plain HTML or JS.
The matching closing tag is inserted when / of the closing tag is entered
This works for HTML and JavaScript, and for other formats that render HTML like Vue or Markdown.
There are some settings you can check if it's not working:
html.autoClosingTags
is true
true
by defaultauto-close-tag.excludedTags
auto-close-tag.activationOnLanguage
auto-close-tag.fullMode
false
, but setting to true
makes it seem more consistentUpvotes: 6