我目前正在使用最新版本的 VSCode 和 Django。每当我启用 Baptiste Darthenay 的 Django 扩展时,HTML 自动完成功能就会停止工作。如果我禁用 Django 扩展并重新加载 VSCode,它将再次开始工作。我应该怎么做才能使 HTML 自动完成功能与 Django 扩展一起工作?
1411 次
3 回答
2
尝试将此添加到您的 settings.json 文件中:
"emmet.includeLanguages": {
"django-html": "html",
"jinja-html": "html"
}
此外,您还可以添加这个并将其调整为您的偏好:
"[django-html]": {
"editor.defaultFormatter": "HookyQR.beautify",
"editor.quickSuggestions": {
"comments": true,
"other": true,
"strings": true
},
"editor.tabSize": 4,
"editor.wordWrap": "on"
}
于 2021-02-12T15:15:54.560 回答
0
尝试以下对我有用的解决方案:
- 将您的 VSCode 打开到您的 Django 项目。
- 打开一个 HTML 文件(例如在您的模板文件夹中)
- 在 VSCode 屏幕的右下方,您将看到“Django HTML”
- 单击它,然后将您带到语言选择屏幕
- 键入 HTML 并单击
- 您会注意到右下角的提示现在将更改为“HTML”
- 您现在应该可以正常使用 HTML 的自动完成功能
于 2021-06-08T12:45:02.887 回答
0
只有通过添加修复您提到的问题"emmet.includeLanguages": {"django-html": "html"}
。settings.json
前:
{
"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
}
}
}
后:
{
"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
}
}
}
你可以在这里看到讨论:https ://github.com/vscode-django/vscode-django/issues/16
于 2021-06-16T10:25:16.763 回答