在 VS Code 中关闭 HTML 标签时再次需要手动缩进

Manually indent needed again when HTML tag is closed in VS Code

在 Microsoft VS Code 中,当我关闭 HTML 标签(例如在底部图像上)时,当前位置将移至第一列并删除标签缩进。然后我需要再次使用制表符手动缩进。我该如何解决?

我的 settings.json 文件:

...
"editor.detectIndentation": false,
"editor.wrappingIndent": "none",
"editor.trimAutoWhitespace": false,
"files.trimTrailingWhitespace": false,
"files.insertFinalNewline": true,
"html.format.endWithNewline": false,
...

在您的 settings.json"editor.detectIndentation": false 中,是您的问题。使 true.

...
"editor.detectIndentation": true,
"editor.wrappingIndent": "none",
"editor.trimAutoWhitespace": false,
"files.trimTrailingWhitespace": false,
"files.insertFinalNewline": true,
"html.format.endWithNewline": false,
...

我将 settings.json 中的选项设置为:


    "editor.detectIndentation": true,
    "editor.autoIndent": false

现在可以使用了。固定。