【问题标题】:how to remove prettier code-formatter plugin completely in vs code?如何在 vs 代码中完全删除更漂亮的代码格式化插件?
【发布时间】:2020-04-25 20:04:09
【问题描述】:

我通过卸载按钮卸载了 prettier code-formatter 插件,但是当我保存 react js 文件时,它会自动格式化代码。

setting.json 文件是什么样子的

{
"workbench.iconTheme": "material-icon-theme",
"window.zoomLevel": 1,
"editor.fontFamily": "Monaco, Menlo, 'Courier New', monospace",
"files.autoSave": "afterDelay",
"npm.enableScriptExplorer": true,
"[javascript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"[json]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"editor.suggestSelection": "first",
"vsintellicode.modify.editor.suggestSelection": "automaticallyOverrodeDefaultValue",
"[html]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
},
"debug.node.autoAttach": "on",
"diffEditor.ignoreTrimWhitespace": true,
"window.zoomLevel": 2,
"prettier.jsxSingleQuote": true,
"editor.codeActionsOnSave": {
    "source.organizeImports": true
},
"editor.formatOnSave": true,
"prettier.endOfLine": "auto",
"eslint.autoFixOnSave": true,
"git.autofetch": true,
"[ruby]": {},
"terminal.integrated.shell.osx": "/bin/bash"

}

我想知道如何摆脱 esbenp.prettier-vscode

【问题讨论】:

    标签: javascript visual-studio-code vscode-settings prettier


    【解决方案1】:

    打开命令面板> 使用...格式化文档> 配置默认格式化程序

    您需要在活动选项卡中打开一个 HTML 文件。这应该让您可以选择内置 HTML 语言功能,从而更改 JSON 中相应设置的值。

    要完全禁用格式化,您需要取消选中“保存时格式化”和“类型时格式化”,或者使用 false 值编辑相应的 "editor.formatOnSave""editor.formatOnType" 字段。

    【讨论】:

    • 你能告诉我 "editor.formatOnSave""editor.formatOnType" 的完整路径吗?。
    • 您的所有设置(除非您有工作区设置)都在您在问题中引用的 settings.json 中。您可能更容易使用设置 UI。您可以使用 ⌘ +, (Ctrl+,) 打开它并搜索“格式”
    猜你喜欢
    • 2023-02-19
    • 2019-08-24
    • 2018-04-22
    • 2019-12-07
    • 1970-01-01
    • 2020-09-25
    • 2020-07-04
    • 2020-06-28
    • 1970-01-01
    相关资源
    最近更新 更多