VS Code 缩进宽度为 4,但仍然有制表符宽度为 8,如何?

问题描述

我有一个使用奇怪缩进样式的旧代码库。它使用制表符宽度 8,但缩进 4 个槽口,并在可能的情况下用制表符替换 8 个空格。

代码应如下所示:

____if (foo) {
TAB---->if (bar) {
TAB---->____something();
TAB---->}
____}

我已经安装了 EditorConfig for Visual Studio Code 扩展并且我的 .editorconfig 有这个:

root = true

[*]
insert_final_newline = true
indent_size = 4
tab_width = 8

但是现有的代码是这样的:

____if (foo) {
TAB>if (bar) {
TAB>____something();
TAB>}
____}

当我添加 indent_style = tab 时,现有代码看起来再次正确,但是当我输入新代码时,我得到:

____if (foo) {   // after hitting Enter on this line the next line is indented too far:
TAB---->____something
____}

如何实现所需的显示和缩进行为?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)