Reputation: 1295
I'm having trouble with my new installed Visual Studio Code on Windows 7. On Mac the editor automatically closes html tags but on my Win7 not. I assume there must be some option to turn it on but I can't find any.
I'm talking about when eg. writing <html
the intelliSense pops up and you click enter, usually it automatically puts in the </html>
mine's not working.
(The IntelliSense pops up but when you select one of the options it doesn't auto close the tag: <h1> -> </h1>
)
Upvotes: 128
Views: 243845
Reputation: 31
Goto Settings cmd+,
find Emmet: Included Languages
add
add Item django-html
Value html
Upvotes: 1
Reputation: 31
If HTML tags autocompleting issue is on JavaScript files, then you just need to change "select language mode" from "JavaScript" to "JavaScript React".
Upvotes: 2
Reputation: 4745
If you want to keep "Django HTML" as the file language and still have auto-closing tags, just add the following to settings.json
(provided you have the auto close tag
extension installed):
"auto-close-tag.activationOnLanguage": [
"django-html",
(...other languages if needed)
],
Upvotes: 5
Reputation: 322
Upvotes: 8
Reputation: 395
If you type
div.class
and then press TAB, VS code will automatically close the DIV tag with the given CLASS
But I think you want to do this operation by pressing the ENTER key.
In that case, go to your VS Code user setting & paste the following code:
"emmet.includeLanguages": {
"javascript": "javascriptreact",
"vue-html": "html",
"razor": "html",
"plaintext": "jade"
}
Now if you type
div.class
& then press the ENTER key, you can see the magic.
However, the above code will make your VS Code auto-completion with ENTER key not only for normal HTML but also the JSX of React, Vue.js snippets will also cover by this.
But If you want to do it only for HTML file, just the following line is enough:
"emmet.includeLanguages": { "javascript": "html" }
Cheers..
Upvotes: 2
Reputation: 61
Press ๐๐ญ๐ซ๐ฅ+๐ฌ๐ก๐ข๐๐ญ+๐ --> type in ๐๐ก๐๐ง๐ ๐ ๐๐๐ง๐ ๐ฎ๐๐ ๐ ๐๐จ๐๐ --> then select ๐๐ฎ๐ญ๐จ ๐๐๐ญ๐๐๐ญ
It works for me.
Upvotes: 6
Reputation: 108
Just check the bottom of your vscode and change the language mode to HTML It might have been showing django-html or click ctrl + shift + p to change the language mode Screenshot
Now click [!] + TAB voila it's done!!!
Upvotes: 1
Reputation: 720
I was suffering from the same problem,then I uninstalled unnecessary extensions from VS Code along with JavaScript (SE) extension and it worked for me.
Upvotes: 1
Reputation: 684
Press Ctrl + Shift + P
to open the command.
Then, type Change Language Mode
an select HTML
or any other desired language.
Upvotes: 2
Reputation: 650
Upvotes: 19
Reputation: 22298
From the 0.3.0 release notes
HTML auto closing of tags has now been removed and replaced with smarter IntelliSense on
</
.
Upvotes: 53
Reputation: 981
I've encountered same problem on Mac Sierra (10.12.6) with VSCode (1.30.2), while editing an HTML file. According to the vscode documentations https://code.visualstudio.com/docs/languages/html, the intellisense should work out of box.
Turned out that the "Language Detection" (on the right corner of editor status bar at the bottom of screen) is set to Automatic Detection, and recognized the file as django-html
. When manually switched back to plain Html, everything works.
Upvotes: 9
Reputation: 3064
I was experiencing the same problem, then i saw something on my bottom right of vs code.. instead of using HTML, i was using Django-HTML, so i changed the language to html, Boom everything is working fine again.see image
Upvotes: 226
Reputation: 360
File > Preferences > Keymaps, Search 'Auto close' and click on install. If it doesn't work, reload the plugin.
Upvotes: 2
Reputation: 32859
Here is a cool trick (actually an Emmet abbreviation) :
h1
h1*
<h1></h1>
)ยญ
PS: This also works for self-closing tags, such as - input
, img
etc.
Upvotes: 32
Reputation: 3181
Type the tag name (without starting <
) then press Tab
for example type div
then press tab and VS will convert it to <div></div>
Or type the opening tag then press Tab twice
for example :
<div
it will add the closing tag
Upvotes: 220