Visual Studio中添加空格后if语句 [英] Visual Studio adding space after if-statements

查看:189
本文介绍了Visual Studio中添加空格后if语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有时(但并非总是如此!?)当我粘贴或结束分号一条线,Visual Studio将添加如果语句之后的空间!例如,粘贴时,该

Sometimes (but not always!?) when I paste or end a line with a semi-colon, Visual Studio will add a space after the if statement! For example, when pasting, this

if()

会变成这样:

if (condition)

和,完成了线的时候,这个

and, when completing a line, this

if(condition)
    DoSomething()

会变成这样的:

if (condition)
    DoSomething();



不必不断地删除这个空间(有时两次!)绝对是推动我的疯狂!的它似乎与发生,如果,而而不是

Having to constantly delete this space (sometimes twice!) is driving me absolutely Bonkers! It seems to happen with if and while but not for.

我无法找到与此在VS选项什么。我已安装ReSharper的,但它被设置为不自动添加空间:

I cannot find anything relating to this in the VS options. I do have Resharper installed, but it is set to not add the space automatically:

为什么Visual Studio的惩罚我?

推荐答案

在Visual Studio中的选项,在文本编辑器/ C#/格式化/间距,在设置其他间距选项部分,有控制流语句关键字后插入空间的选项。

In the Visual Studio options, under Text Editor / C# / Formatting / Spacing, in the "Set other spacing options" part, there's an option for "Insert space after keywords in control flow statements".

我的犯罪嫌疑人的你会发现你已经得到了遏制,而你不希望它是。 (我是故意的检查:)

I suspect you'll find you've got that checked, and you don't want it to be. (I have it checked deliberately :)

这篇关于Visual Studio中添加空格后if语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆