I am currently using the latest version of VSCode and Django. Whenever I enable the Django extension by Baptiste Darthenay, HTML autocomplete stops working. If I disable the Django extension and reload VSCode, it will start to work again. What should I do to make the HTML autocomplete work along with the Django extension?
Asked
Active
Viewed 8,748 times
10
-
Do you mean autocomplete as in Emmet? (ex. typing `.my-class` creating a div with that class?). – Guillermo Brachetta Feb 12 '21 at 15:11
-
1What I am talking about is the most basic autocomplete i.e. type `h1` and it will suggest an autocomplete for h1 header. – nishorgo Feb 12 '21 at 15:13
5 Answers
19
Try adding this to your settings.json file:
"emmet.includeLanguages": {
"django-html": "html",
"jinja-html": "html"
}
Additionally you can also add this one and tweak it to your preferences:
"[django-html]": {
"editor.defaultFormatter": "HookyQR.beautify",
"editor.quickSuggestions": {
"comments": true,
"other": true,
"strings": true
},
"editor.tabSize": 4,
"editor.wordWrap": "on"
}

Guillermo Brachetta
- 3,857
- 3
- 18
- 36
-
Just imputing the top code enables the autocomplete but only if you don't begin your tags with "<". Just typing "p" or "div" and clicking tab will auto-complete. Also `"django-html": "html"` seems like it is enough. Could you tell me what the second line does as I didn't notice anything different with Jinjas auto-completion. :) – Cewu00 Jun 26 '22 at 02:29
12
Try the below solution which worked for me:
- With your VSCode open to your Django project.
- Open an HTML file (e.g within your templates folder)
- At the bottom right of the VSCode screen you will see 'Django HTML'
- Click on that, which then takes you to a language selection screen
- Type HTML and click
- You will notice the prompt at the bottom right will now change to 'HTML'
- You should now have autocomplete for HTML working well

AlexGithui
- 121
- 1
- 3
5
For those who can't find settings.json, you can just go to Settings>Extensions>Emmet>Include Languages. Then, click on Add Item and fill in:
key: django-html
value: html

Zharfan Zahisham
- 143
- 1
- 9
2
Django template language syntax highlighting in html
!
No need to switch to django-html
!
Use this extension : Django Support (zero config)

Al Mahdi
- 635
- 1
- 9
- 16
1
Only by adding "emmet.includeLanguages": {"django-html": "html"}
in settings.json
fixed the problem you mentioned.
Before:
{
"terminal.integrated.rendererType": "dom",
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"C_Cpp.updateChannel": "Insiders",
"grunt.autoDetect": "on",
"files.associations": {
"*.html": "django-html"
},
"[django-html]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
}
}
After:
{
"terminal.integrated.rendererType": "dom",
"liveServer.settings.donotVerifyTags": true,
"liveServer.settings.donotShowInfoMsg": true,
"javascript.updateImportsOnFileMove.enabled": "always",
"workbench.editorAssociations": {
"*.ipynb": "jupyter.notebook.ipynb"
},
"C_Cpp.updateChannel": "Insiders",
"grunt.autoDetect": "on",
"files.associations": {
"*.html": "django-html"
},
"emmet.includeLanguages": {"django-html": "html"},
"[django-html]": {
"editor.quickSuggestions": {
"other": true,
"comments": true,
"strings": true
}
}
}
You can see the discussion here: https://github.com/vscode-django/vscode-django/issues/16

Amal K
- 4,359
- 2
- 22
- 44

Pramod Pujara
- 23
- 4