作者:书友23295799 | 来源:互联网 | 2023-02-13 19:33
每当我让vscode autoformat我的代码时,它格式化为2个空格而不是4个,即使显然默认是4个空格,我还没有触及settings.json
Editor.tabsize也显示4.
在右下角,它显示空格:4,但在autoformatting之后,它显示空格:2,无论我将其更改为4多少次,它都会恢复为2.
任何人都知道发生了什么.如果这很重要,Ruby就会发生这种情况.
另外,有没有人知道VScode的备用压头/ autoformatter?
1> 小智..:
我认为您可能遇到"自动检测缩进"问题.您应该尝试将其关闭,看看是否有帮助.
// The number of spaces a tab is equal to. This setting is overriden based on the file contents when `editor.detectIndentation` is on.
"editor.tabSize": 4,
// When opening a file, `editor.tabSize` and `editor.insertSpaces` will be detected based on the file contents.
"editor.detectIndentation": false