如何防止美化扩展内联格式化Javascript?

How to Prevent the Beautify Extension from Formatting Inline Javascript?

我希望 ESLint 扩展成为内联中唯一的格式化程序 Javascript。美化只是搞砸了,我必须手动更正它。

我已将这些行添加到我的 .jsbeautifyrc 文件中:

    "format.contentUnformatted": "script",
    "format.unformatted": "script", 

但是没有效果:美化仍然格式化html文件中的每一行。我忽略了什么?

根据 documentation 它应该是这样的:

{
  "unformatted": ["script"]
}

如果这不起作用,那么也许使用 language 设置这可能会起作用。

You can control which file types, extensions, or specific file names should be beautified with the beautify.language setting.

{
 "beautify.language": {
   "js": {
     "type": ["javascript", "json"],
     "filename": [".jshintrc", ".jsbeautifyrc"]
     // "ext": ["js", "json"]
     // ^^ to set extensions to be beautified using the javascript beautifier
   },
   "css": ["css", "scss"],
   "html": ["htm", "html"]
   // ^^ providing just an array sets the VS Code file type
 }
}

以上配置应仅对指定的 .js 文件启用格式化。

祝你好运。