VSCode html-files格式化程序无法正常工作

时间:2017-12-21 08:37:35

标签: visual-studio-code

我有智能感知问题 我已禁用所有扩展程序,但我仍然得到:

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

任何想法?

VS Code版本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,

由于

2 个答案:

答案 0 :(得分:1)

我对VSC 1.30版有同样的问题。这些步骤解决了我的问题:

  1. Ctrl+K Ctrl+O选择html文件所在的文件夹。
  2. 打开文件资源管理器Ctrl+Shift+E并打开html文件
  3. Ctrl+Shift+I

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

答案 1 :(得分:0)

遇到此问题时,我正在使用不在打开的文件夹或VSC工作区中的单个html文件。当我设置一个包含文件的工作区时,html格式器起作用了。