如何关闭 Visual Studio 的格式选项? [英] How do I turn off Visual Studio's formatting options?

查看:21
本文介绍了如何关闭 Visual Studio 的格式选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我在 Visual Studio 中遇到了这个烦人的问题(使用 C# 时),我一直在研究 C# 格式选项、一般 VS 选项以及 google 和 MSDN,但无法真正找到解决此问题的方法 -我假设某处只有一个复选框,而我只是忽略了它.这是:

So I have this annoying issue with Visual Studio (when working with C#), I've been digging around in the C# formatting options, general VS options and on google and MSDN but can't really find a fix for this - I'm assuming there's just a checkbox somewhere and I've just overlooked it. Here it is:

我喜欢这样格式化我的代码:

I like to format my code like this:

Type var2    = new Type();
Type someVar = new Type();

但是visual studio坚持这样格式化,无论何时应用自动格式功能:

But visual studio insists on formatting it like this, whenever the automatic format feature is applied:

Type var2 = new Type();
Type someVar = new Type();

在哪里可以关闭这个烦人的功能?

Where do I turn this annoying feature off?

推荐答案

在格式选项中,在间距部分:

In the Formatting Options, In the Spacing section:

有一个选项叫做'忽略声明语句中的空格'.选中该选项,VS.NET 将不会重新格式化您所做的声明.

there is an option called 'Ignore spaces in declaration statements'. Check that option, and VS.NET will not re-format the declarations that you make.

所以,这应该有效:

int i      = 5;
int melp   = 4;

但是,当您这样做时,VS.NET 仍会重新格式化您的代码:

But, when you do this, VS.NET will still reformat your code:

int i;
int melp;

i    = 5;
melp = 4;

将变成:

int i;
int melp;

i = 5;
melp = 4;

因此,实际上只有在声明语句中 VS.NET 才会忽略您提供的额外间距.

So, it is really only in declaration statements that VS.NET will ignore the extra spacing you provide.

这篇关于如何关闭 Visual Studio 的格式选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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