得到正确的缩进ReSharper的对象和数组的初始化 [英] Get correct indentation in Resharper for object and array initializers

查看:106
本文介绍了得到正确的缩进ReSharper的对象和数组的初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

现在ReSharper的格式我们的代码是这样的:

Right now resharper formats our code like this:

private readonly List<Folder> folders = new List<Folder>
                                        {
                                            new Folder()
                                        };



但我希望它看起来是这样的:

but I want it to look like this:

private readonly List<Folder> folders = new List<Folder>
{
    new Folder()
};



我一直用的选项搞乱了不少,但似乎无法让他们的权利。你能帮忙吗?

I've been messing with the options a lot, but can't seem to get them right. Can you help?

推荐答案

我有匿名委托了同样的问题。匿名委托格式化修复的方法是这里

I had the same issue with anonymous delegates. The fix for anonymous delegate formatting is here:

我也终于找到解决
这样的方式。格式化
匿名方法的选择跨
流传于ReSharper的
选项的两个独立的网页:牙套布置等。在
不缩进一个可笑的数额,是
中的其他页面上,它被称为
缩进匿名方法体。打开
其关闭,并设置括号选项
在行结束,你会得到
的东西好得多:

I did finally find the way to fix this. The options for formatting anonymous methods are spread across two separate pages in ReSharper options: Braces Layout and Other. The "don’t indent a ridiculous amount" is on the Other page, and it’s called "Indent anonymous method body". Turn it off, and set the brace option to "At end of line", and you get something much nicer:

但我不知道有关实例声明集格式化我害怕。 (

But i'm not sure about the instance declaration collection formatting i'm afraid. :(

这篇关于得到正确的缩进ReSharper的对象和数组的初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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