简体   繁体   English

VS Code 的 html 问题

[英]VS Code issues with html

I'm having a few issues in VS Code specifically with HTML files.我在 VS Code 中遇到了一些专门针对 HTML 文件的问题。

  1. The HTML boilerplate feature is not working (typing '!'). HTML 样板功能不起作用(键入“!”)。
  2. On existing html files that have content, the "Open in Browser" feature is no longer shown.在包含内容的现有 html 文件上,不再显示“在浏览器中打开”功能。 I even see my "open-in-browser.default": "Safari" is configured in settings.json.我什至看到我的 "open-in-browser.default": "Safari" 在 settings.json 中配置。

Not sure what change I might've done that caused this as both features were working fine not too long ago.不确定我可能做了什么改变导致了这种情况,因为不久前这两个功能都运行良好。

Fixed both issues which were actually connected.修复了实际连接的两个问题。 For some reason my vs code was identifying .html files as Django files.出于某种原因,我的 vs 代码将 .html 文件识别为 Django 文件。 I went into the settings.json and added the following to ensure .html files would be classified as html files我进入 settings.json 并添加以下内容以确保 .html 文件将被归类为 html 文件

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

This then allowed the open in browser extension to identify the file as html and enable the open in default browser option along with fixing the boilerplate issue.然后,这允许在浏览器扩展中打开以将文件识别为 html 并启用在默认浏览器中打开选项以及修复样板问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM