在VS Code中识别为Django Template的HTML文件

问题描述 投票:10回答:3

我是VS的新手,在此之前来自ST3和TextMate。有点不知所措,为什么HTML没有被自动检测,也没有在点击右下方的语言指示符后作为语言选择提供?

Screenshot after selecting "Configure File Association for '.html'..."

我已经尝试明确地将"files.associations": {"*.html": "html"}添加到用户设置无效。

在macOS v10.12.6上运行VSCode v1.15.1。

html visual-studio-code vscode-settings
3个回答
13
投票

解决了!我开始消除扩展,发现Django Template 1.2.0(bibhasdn.django-html)应该受到指责。一旦禁用它,HTML选项就会返回到“语言关联”菜单。帽子提示@ifconfig确认我应该期待它存在。


3
投票

包括将emmet.includeLanguages": {"django-html": "html"}设置为VS代码setting.jason:

{
"python.jediEnabled": false,
"files.autoSave": "afterDelay",
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": 
"automaticallyOverrodeDefaultValue",
"editor.minimap.enabled": true,
"workbench.colorTheme": "Monokai",
"editor.largeFileOptimizations": false,
"html.format.indentInnerHtml": true,
"html.format.indentHandlebars": true,
"emmet.includeLanguages": {"django-html": "html"},
"[django-html]": {

},
"files.associations": {
    "*.html": "html"
}

}

它修复了我的版本1.33.1


2
投票

包含DJANGO软件包的Python扩展包使VSCOde将所有html视为Django模板并将注释设置为{%comment%}而不是<!-- -->

删除它解决了这个问题。

© www.soinside.com 2019 - 2024. All rights reserved.