c++visual-studioresharper-c++

Resharper C++ Lambda Braces Indentation


I am using Resharper C++.

I have code that often uses lambdas as function parameters, and I want them aligned as such:

return Method(
    [&]() -> bool
    {
        return this.variable >= 0;
    },
    "a normal parameter");

i.e. I want all parameters aligned on "one clear vertical line".

However, Resharper will align it as such:

return Method(
    [&]() -> bool
{
    return this.variable >= 0;
},
    "a normal parameter");

Which is obviously far less readably (especially when working with functions that use many lambdas and many "normal" parameters.

Neither

RESHARPER -> Options -> C++ -> Formatting Style -> Braces Layout -> Other statements and blocks

nor

RESHARPER -> Options -> C++ -> Formatting Style -> Braces Layout -> Other braces

seemed to work (or work without undesired side effects).

I am looking for a solution as described here: Resharper C# lambda indentation but I can't seem to find one for Resharper C++.

Now, my questions are:

  1. Is the way I want to indent the braces a common approach or should I look for another?

  2. How can I accomplish that particular formatting (if it is possible at all)?

Thank in advance you for your help


Solution

  • This is a bug in ReSharper's formatting logic. I filed RSCPP-19853, it should be fixed in the next release. Please vote for the issue to receive updates.