如何在长行返回关键字后停止Resharper的换行?

Tod*_*son 30 c# resharper resharper-8.0

当我使用Resharper CTRL + ALT + SHIFT + F自动格式化超过最大行长度的行(在我的情况下说它是80个字符)时,我得到以下内容:

    return
        View(new ViewModel
        {
            Identifier = identifier,
            Files = service.AllFiles()
        });
Run Code Online (Sandbox Code Playgroud)

但我真正想要的是不要在"return"关键字之后换行(即在一行中没有自己的return关键字),如下所示:

    return View(new ViewModel
    {
        Identifier = identifier,
        Files = service.AllFiles()
    });
Run Code Online (Sandbox Code Playgroud)

有谁知道如何"配置"Resharper来实现这一目标?:)

这是另一个例子,这是我现在看到的:

    return
        repository.Session.CreateCriteria(typeof(SomeType))
                  .Add(Expression.Eq("Identifier", identifier))
                  .UniqueResult<SomeType>();
Run Code Online (Sandbox Code Playgroud)

当我真的想看到:

    return repository.Session.CreateCriteria(typeof(SomeType))
                     .Add(Expression.Eq("Identifier", identifier))
                     .UniqueResult<SomeType>();
Run Code Online (Sandbox Code Playgroud)

更新:

这里是"总是剁":

    return View(new OrganisationFileLoadViewModel
    {
        Identifier = identifier,
        AllExistingOrganisationFiles = nmdsOrganisationFileLoadService.AllNMDSOrganisationFiles()
    });
Run Code Online (Sandbox Code Playgroud)

这是"剁长":

    return
        View(new OrganisationFileLoadViewModel
        {
            Identifier = identifier,
            AllExistingOrganisationFiles = nmdsOrganisationFileLoadService.AllNMDSOrganisationFiles()
        });
Run Code Online (Sandbox Code Playgroud)

TyC*_*obb 40

Resharper -> Options -> (Code Editing) C# -> Formatting Style -> Line Breaks and Wrapping

换行有很多设置.默认值Wrap long lines通常是 120字符.这可能会触发您的设置,因为您设置为80或Resharper 8.0可能有更新的返回选项.上面的路径是7.0,但我相信它与8.0相同或至少相似.

不错的是,他们会向您展示您所做更改的示例,因此您无需立即对其进行测试.