c# - Resharper 过度缩进我的代码

标签 c# resharper

我希望 resharper 按以下方式缩进我的代码:

var modification = shortUrlIndexCollection.FindAndModify
(
    Query.Or
    (
        Query.And
        (
            Query.EQ("_id", "Index"),
            Query.EQ("LockId", Guid.Empty)
        ),
        Query.LT("UnlockOn", now)
    ),
    SortBy
        .Null,
    Update
        .Set("LockId", guid)
        .Set("UnlockOn", now + reserveDuration),
    true
);

但它会按照以下方式格式化我的代码:

var modification = shortUrlIndexCollection.FindAndModify
    (
        Query.Or
            (
                Query.And
                    (
                        Query.EQ("_id", "Index"),
                        Query.EQ("LockId", Guid.Empty)
                    ),
                Query.LT("UnlockOn", now)
            ),
        SortBy
            .Null,
        Update
            .Set("LockId", guid)
            .Set("UnlockOn", now + reserveDuration),
        true
    );

根据 Custom Brace formatting with Resharper我已经尝试过 continuous line indent multiplier 选项,但它给出了错误的结果...

最佳答案

尝试 Resharper 7.1它修复了链接方法的缩进。

刚刚用我的 stylecop 设置试了一下,格式变成了:

shortUrlIndexCollection.FindAndModify(
                Query.Or(
                    Query.And(Query.EQ("_id", "Index"), Query.EQ("LockId", Guid.Empty)), Query.LT("UnlockOn", now)),
                SortBy.Null,
                Update.Set("LockId", guid).Set("UnlockOn", now + reserveDuration),
                true);

不是你想要的。

关于c# - Resharper 过度缩进我的代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13387385/

相关文章:

c# - pdatASP.NET Forms 身份验证 CSS 样式不起作用

c# - url Unicode 字符编码

c# - IronPython 无法导入模块 cv2 (OpenCV)

c# - 用于创建派生类型的 Resharper 编辑模板

c# - 使用 Resharper 自动删除未使用的代码

c# - DateTime as empty String or null ?如何检查?

visual-studio - 有没有办法使用 ReSharper 查找 .NET 项目中所有未使用的代码?

visual-studio - ReSharper 键绑定(bind)问题

c# - 有没有办法*防止* ReSharper 并行运行程序集的单元测试?

c# - 如何在 C# 中为 Azure Function App 安装 SharePoint PowerShell 模块