Search code examples
c#rider

How to configure indentation for lambdas in invocations in Rider?


I want to configure the code style settings of JetBrains Rider. I want to format a function as this:

protected override JobHandle OnUpdate(JobHandle inputDeps) {
    Entities.ForEach((ref PaddleMovementData moveData, in PaddleInputData inputData) => {
        moveData.direction = 0;
        moveData.direction += Input.GetKey(inputData.upKey) ? 1 : 0;
        moveData.direction -= Input.GetKey(inputData.downKey) ? 1 : 0;
    }).Run();

    return default;
}

Yet Rider gives me this:

protected override JobHandle OnUpdate(JobHandle inputDeps) {
    Entities.ForEach((ref PaddleMovementData moveData, in PaddleInputData inputData) => {
                moveData.direction = 0;
                moveData.direction += Input.GetKey(inputData.upKey) ? 1 : 0;
                moveData.direction -= Input.GetKey(inputData.downKey) ? 1 : 0;
            }
        )
        .Run();

    return default;
}

I can't find a way to fix that. In CLion it is possible, so I guess the same is true for Rider. How can I do that?


Solution

    1. Format your code as you want
    2. select your code
    3. use detect formatting

    If such formatting rule exists it will be shown like this: enter image description here

    So they are the related formatting settings!