我目前正在使用最新版本的VSCode和Django。每当我启用Baptiste Darthenay的Django扩展时,HTML自动完成就会停止工作。如果我禁用Django扩展并重新加载VSCode,则它将再次开始工作。我该怎么做才能使HTML自动完成与Django扩展一起工作?
我目前正在使用最新版本的VSCode和Django。每当我启用Baptiste Darthenay的Django扩展时,HTML自动完成就会停止工作。如果我禁用Django扩展并重新加载VSCode,则它将再次开始工作。我该怎么做才能使HTML自动完成与Django扩展一起工作?
尝试将以下内容添加到您的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"
}
如果找不到settings.json文件,可以直接进入设置>扩展>Emmet>包含语言。然后,点击添加项目并填写以下内容:
key: django-html
value: html
只有在settings.json
中添加"emmet.includeLanguages": {"django-html": "html"}
才能解决你提到的问题。
之前:
{
"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
.my-class
会创建一个具有该类的 div 元素?) - Guillermo Brachetta