VS Code 中识别为 Django 模板的 HTML 文件

新手上路,请多包涵

我是 VS Code 的新手,之前来自 ST3 和 TextMate。有点困惑,为什么在点击右下角的语言指示器后,HTML 没有被自动检测到,也没有作为语言选择提供?

选择“为‘.html’配置文件关联…”后的屏幕截图

我已经尝试将 "files.associations": {"*.html": "html"} 显式添加到用户设置,但没有效果。

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

原文由 nootrope 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 942
2 个回答

在 VSCode 的 settings.json 中包含以下设置行 emmet.includeLanguages": {"django-html": "html"}

 {
  "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 版

原文由 Blue Sky 发布,翻译遵循 CC BY-SA 4.0 许可协议

解决了! 我开始消除扩展,发现 Django 模板 1.2.0 ( bibhasdn.django-html ) 是罪魁祸首。一旦我禁用它,HTML 选项就会返回到“语言关联”菜单。向@ifconfig 致敬以确认我应该期望它存在。

原文由 nootrope 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题