将现有代码推送到新行时如何停止 VSCode 缩进?

How to stop VSCode indenting when pushing existing code to a new line?

我写了一些代码,每次我回车下推,它一直缩进。 有没有办法阻止这种行为?

缩进是由Editor: Auto Indent首选项的full/advanced设置的onEnterRules引起的:

为避免此问题,您可以将设置更改为 keepnone,但请注意,它会全局更改您的首选项(对于任何需要缩进的文件类型)。

看起来可能 way to configure the onEnterRules per language, but I'm not entirely sure how to do that yet. Editing the language specific setting in JSON 具有以下配置 对我有用:

{
  "[scss]": {
    "editor.autoIndent": "keep"
  }
}