当我使用MonoDevelop(快捷键:Ctrl + I)进行代码格式化时,所有内容都会双重缩进:
namespace Example { public class Test { public static void Main(string[] args) { for (int i = 0; i < 10; i++) { Console.WriteLine("{0}: Test", i); } //this would be the desired indentation width! //Not this! } } }
使用源代码 - >代码格式 - > 文本样式下的C#源代码检查首选项,选项卡宽度和缩进宽度设置为4.尽管如此,我得到的缩进宽度为8而不是4,因此缩进的次数是原来的两倍.
我正在使用Unity3D和使用MonoDevelop-Unity 4.0.1版进行团队项目.
事实证明,解决方案/项目本身应用了不同的代码格式,并且它从首选项覆盖了我的设置.
要调整解决方案/项目特定设置,请右键单击Solution/Project
并选择Options
.在Source Code->Code Formatting->C# source
此代码格式化时应用的此解决方案/项目的实际选项卡宽度和缩进宽度设置.