Visual Studio改变了Ctrl-K-D的工作方式。

时间:2023-01-14 15:29:13

In Visual Studio (I'm using 2012), is there any way of editing the way that Ctrl-K-D combinations handles its Auto-Formatting?

在Visual Studio中(我正在使用2012),有没有什么方法可以编辑Ctrl-K-D组合来处理它的自动格式?

I don't mean changing what these key combinations do, I mean extending the way the auto-formatting is done.

我不是说要改变这些关键的组合,我的意思是扩展自动格式化的方式。

The way it handles tabbing, etc are fine, I'm more concerned with white-space.

它处理表格的方式很好,我更关心的是空白。

We're using a plugin that makes it easy to align variable properties, making them easy to read. Like so:

我们使用的是一个插件,使其易于对齐可变属性,使其易于阅读。像这样:

var test            = 'whatever',
    another         = 'this one',
    alignedProperly = 'yay';

Seems nitt-picky yes, but in really large Object literals it's so helpful to be able to read them!

看起来很挑剔是的,但是在真正的大型对象文字中,能够阅读它们是很有帮助的!

Has anyone found where the rules for auto-formatting are located, and if they can be edited/changed? (Can't find them anywhere in the options!)

有没有人发现自动格式设置的规则在哪里,如果可以编辑/修改?(在选项中找不到它们!)

2 个解决方案

#1


15  

Are you looking for:

你所寻找的是:

Tools > Options > Text Editor > C# > Formatting > Spacing > Set other spacing options > Ignore space in declaration statements

>选项>文本编辑> c# >格式化>间距>设置其他空格选项>忽略空格在声明语句中。

This is in VS 2010, but i guess 2012 should be somewhat similar.

这是VS 2010,但我想2012应该有点类似。

#2


1  

In VS 2017:

在VS 2017:

Tools > Options > Text Editor > C# > Code Style > Formatting > Spacing > Set other spacing options > Ignore space in declaration statements

>选项>文本编辑> c# >代码样式>格式>设置其他间距选项>在声明语句中忽略空格。

#1


15  

Are you looking for:

你所寻找的是:

Tools > Options > Text Editor > C# > Formatting > Spacing > Set other spacing options > Ignore space in declaration statements

>选项>文本编辑> c# >格式化>间距>设置其他空格选项>忽略空格在声明语句中。

This is in VS 2010, but i guess 2012 should be somewhat similar.

这是VS 2010,但我想2012应该有点类似。

#2


1  

In VS 2017:

在VS 2017:

Tools > Options > Text Editor > C# > Code Style > Formatting > Spacing > Set other spacing options > Ignore space in declaration statements

>选项>文本编辑> c# >代码样式>格式>设置其他间距选项>在声明语句中忽略空格。