'Visual Studio Code disable auto closing tags
I'm trying to prevent auto closing tags, but the following setting doesn't seem to work:
{
"html.autoClosingTags": false,
}
What else must be done to make auto-closing tags go away?
Solution 1:[1]
Just in case anyone looking at this is finding that HTML tags are still being automatically closed inside JSX files. The setting you need is:
{
"javascript.autoClosingTags": false,
"typescript.autoClosingTags": false
}
Solution 2:[2]
Open Visual Studio Code, go to Preferences -> Settings
Under the User Settings
tab, click Text Editor
, and search for the setting Auto Closing Tags
. Uncheck HTML: Auto Closing Tags
This search results also allow you to disable auto closing for JavaScript and TypeScript, if desired.
Based on Visual Studio Code 1.64.2 for macOS.
Solution 3:[3]
For me, the solution was in an extension. I had the Auto Close Tag
extension installed (who knows when I though that was a good idea) that was overriding the built in autoclose. Disabling the extension fixed it.
Take a look through your enabled extensions and see if there's any that might be adding this behavior.
Solution 4:[4]
The following worked for me:
- Go to File > Preference > Setting (Ctrl + ,)
- Extension > HTML
- And remove tick from the "Auto Closing Tags".
Hope this helps. Cheers :)
Solution 5:[5]
You might need to delete the comma after "false" - Visual Studio Code doesn't seem to like commas after the last statement in preferences.
Solution 6:[6]
Just ran into this problem and I went to preferences -> settings -> extensions -> HTML -> disable autoclosing of HTML tags. Hope this helps!
Solution 7:[7]
Disabling autoclosing for only TypeScript generics
To eliminate autoclosing on TS <generic> tags, but leave it on otherwise, install the Auto Close Tag VSCode extension and add the following lines to your JSON user settings:
{
"auto-close-tag.disableOnLanguage": [
"typescript",
"typescriptreact"
]
}
Further Reading: TypeScript Generics: Adds closing "Tag" to type specifier #17
Solution 8:[8]
I just looked this one up myself and noticed there was no verified answer. Those saying you have to go to the HTML portion are absolutely correct, if you don't uncheck that checkbox under HTML: Auto Closing Tags then you will keep getting the closing tags.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | KyleMit |
Solution 2 | |
Solution 3 | Neal |
Solution 4 | KyleMit |
Solution 5 | szmoon |
Solution 6 | Alex M |
Solution 7 | |
Solution 8 | TheWebAdmin |