如何摆脱 VS 代码中烦人的自动格式化?

时间:2021-07-28 01:31:55

标签: reactjs indentation autoformat

我卸载了 prettier 并且我的保存格式未选中,但我不知道为什么我的代码仍然是自动格式化的。任何人都可以帮助我吗?太感谢了! 这是它的样子: enter image description here

enter image description here

enter image description here

顺便说一句,这是我的setting.json:

{
    "java.debug.settings.stepping.skipStaticInitializers": true,
    "editor.parameterHints.enabled": false,
    "html.format.enable": false,
    "html.format.preserveNewLines": false,
    "typescript.format.insertSpaceBeforeAndAfterBinaryOperators": false,
    "typescript.format.insertSpaceAfterFunctionKeywordForAnonymousFunctions": false,
    "typescript.format.insertSpaceAfterOpeningAndBeforeClosingEmptyBraces": false,
    "typescript.format.insertSpaceAfterKeywordsInControlFlowStatements": false,
    "typescript.format.insertSpaceAfterOpeningAndBeforeClosingNonemptyBraces": false,
    "typescript.format.enable": false,
    "typescript.format.insertSpaceAfterCommaDelimiter": false,
    "typescript.format.insertSpaceAfterSemicolonInForStatements": false,
    "javascript.format.enable": false
}

2 个答案:

答案 0 :(得分:0)

您似乎正在查看全局设置。 检查内部 .vscode/settings.json 以查看是否有任何内容将保存时的自动格式设置为 True。如果有,只需删除该行,它将默认为您的默认设置。

答案 1 :(得分:0)

我怀疑这不是您的格式化程序,而是您的 linter。理想情况下,您可以添加自己的 lint 配置文件,以便您可以在项目中自行管理它。
你安装了eslint吗?

您可以将鼠标悬停在任何一条红线上,您应该会看到有关如何解决问题的工具提示。能发个截图吗?

相关问题