Chr*_*Lai 2 visual-studio-code
每当我让vscode autoformat我的代码时,它格式化为2个空格而不是4个,即使显然默认是4个空格,我还没有触及settings.json
Editor.tabsize也显示4.
在右下角,它显示空格:4,但在autoformatting之后,它显示空格:2,无论我将其更改为4多少次,它都会恢复为2.
任何人都知道发生了什么.如果这很重要,Ruby就会发生这种情况.
另外,有没有人知道VScode的备用压头/ autoformatter?
Sam*_*ami 19
对于那些像我一样无法使用上述内容的人,这里有一些 GUI 指南。
按=> CTRL+ ,(评论建议)打开设置或通过菜单进入设置
File->Preferences->Settings
Run Code Online (Sandbox Code Playgroud)
您可以在搜索框中找到(查找tab size和detect indentation),如下图所示(请参阅文本“让我们玩”)
detect indentation=> 取消选中它(关闭)
tab size=> 将其设置为 4
如何 ?需要可视化吗?这里是,
右键单击下面的图像并在新选项卡中打开看清楚
小智 8
我认为您可能遇到"自动检测缩进"问题.您应该尝试将其关闭,看看是否有帮助.
// 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2500 次 |
| 最近记录: |