Visual studio code VSCode html文件格式化程序不工作

Visual studio code VSCode html文件格式化程序不工作,visual-studio-code,Visual Studio Code,我对智能感知有问题 我已禁用所有扩展,但我仍然可以: 抱歉,没有安装html文件的格式化程序 有什么想法吗 VS代码版本1.19.1 // Enable/disable autoclosing of HTML tags. "html.autoClosingTags": true, // List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' t

我对智能感知有问题 我已禁用所有扩展,但我仍然可以:

抱歉,没有安装html文件的格式化程序

有什么想法吗

VS代码版本1.19.1

// Enable/disable autoclosing of HTML tags.
"html.autoClosingTags": true,

// List of tags, comma separated, where the content shouldn't be reformatted. 'null' defaults to the 'pre' tag.
"html.format.contentUnformatted": "pre,code,textarea",

// Enable/disable default HTML formatter
"html.format.enable": true,

// End with a newline.
"html.format.endWithNewline": false,

// List of tags, comma separated, that should have an extra newline before them. 'null' defaults to "head, body, /html".
"html.format.extraLiners": "head, body, /html",

// Format and indent {{#foo}} and {{/foo}}.
"html.format.indentHandlebars": false,

// Indent <head> and <body> sections.
"html.format.indentInnerHtml": false,

// Maximum number of line breaks to be preserved in one chunk. Use 'null' for unlimited.
"html.format.maxPreserveNewLines": null,

// Whether existing line breaks before elements should be preserved. Only works before elements, not inside tags or for text.
"html.format.preserveNewLines": true,

// List of tags, comma separated, that shouldn't be reformatted. 'null' defaults to all tags listed at https://www.w3.org/TR/html5/dom.html#phrasing-content.
"html.format.unformatted": "wbr",

// Wrap attributes.
"html.format.wrapAttributes": "auto",

// Maximum amount of characters per line (0 = disable).
"html.format.wrapLineLength": 120,

// Configures if the built-in HTML language support suggests Angular V1 tags and properties.
"html.suggest.angular1": true,

// Configures if the built-in HTML language support suggests HTML5 tags, properties and values.
"html.suggest.html5": true,

// Configures if the built-in HTML language support suggests Ionic tags, properties and values.
"html.suggest.ionic": true,

// Traces the communication between VS Code and the HTML language server.
"html.trace.server": "off",

// Configures if the built-in HTML language support validates embedded scripts.
"html.validate.scripts": true,

// Configures if the built-in HTML language support validates embedded styles.
"html.validate.styles": true,
//启用/禁用HTML标记的自动关闭。
“html.autoClosingTags”:true,
//标签列表,逗号分隔,内容不应重新格式化。”“null”默认为“pre”标记。
“html.format.contentUnformatted”:“pre,code,textarea”,
//启用/禁用默认HTML格式化程序
“html.format.enable”:true,
//以换行结束。
“html.format.endWithNewline”:false,
//标签列表,逗号分隔,前面应该有一个额外的换行符。”“null”默认为“head,body,/html”。
“html.format.extraLiners”:“head,body,/html”,
//格式和缩进{{{foo}}和{{/foo}。
“html.format.indentHandlebar”:false,
//缩进和部分。
“html.format.indentInnerHtml”:false,
//一个块中要保留的最大换行数。使用“null”表示无限。
“html.format.maxPreserveNewLines”:null,
//是否应保留图元之前的现有换行符。仅适用于元素之前,不适用于标记内部或文本。
“html.format.preserveNewLines”:true,
//不应重新格式化的标记列表,以逗号分隔。”“null”默认为在中列出的所有标记https://www.w3.org/TR/html5/dom.html#phrasing-内容。
“html.format.unformatted”:“wbr”,
//包装属性。
“html.format.wrapatributes”:“自动”,
//每行的最大字符数(0=禁用)。
“html.format.wrapLineLength”:120,
//配置内置HTML语言支持是否建议标签和属性。
“html.suggest.angular1”:正确,
//配置内置HTML语言支持是否建议HTML5标记、属性和值。
“html.suggest.html5”:正确,
//配置内置HTML语言支持是否建议使用Ionic标记、属性和值。
“html.suggest.ionic”:正确,
//跟踪VS代码与HTML语言服务器之间的通信。
“html.trace.server”:“关闭”,
//配置内置HTML语言支持是否验证嵌入式脚本。
“html.validate.scripts”:true,
//配置内置HTML语言支持是否验证嵌入样式。
“html.validate.styles”:true,

谢谢

当我遇到这个问题时,我正在处理一个html文件,它既不在打开的文件夹中,也不在VSC工作区中。当我设置包含该文件的工作区时,html格式化程序工作正常。

我在VSC 1.30版中也遇到了同样的问题。这些步骤解决了我的问题:

  • Ctrl+K Ctrl+O
    选择html文件所在的文件夹
  • 打开文件浏览器
    Ctrl+Shift+E
    并打开html文件
  • Ctrl+Shift+I

    中提琴!我得到了格式化代码

    设置,看起来不错!你能卸载并重新安装VSCode吗?是的,我有,但有趣的是,我通过切换当前打开的项目并将其切换回来解决了问题。我还注意到,如果你的VSCode安装存在持续性问题,那么提交一个bug可能是值得的,这样团队就可以研究它,并希望修复这些问题。单击VSC窗口右下角的笑脸,然后单击“提交错误”。这将在他们的Github页面上打开一个“新问题”窗口,其中包含有关安装的必要信息。这实际上起到了作用。。。它解决了我遇到的很多其他问题。。。主要是VS代码没有自动关闭我的标签。非常感谢。这就是解决方案!谢谢,保存工作区立即为我解决了这个问题。