c++commentsjetbrains-ideriderunreal-engine5

Rider Code Cleanup Auto Indenting on Comments


Does anyone know how to stop Rider's code cleanup tool from affecting the indentation of comments?

For reference whenever I use the code cleanup feature it changes this:

switch (PlayerController->IsPaused())
    {
        // Game is currently unpaused.
        case false:
            // Pause the game.
            UGameplayStatics::SetGamePaused(GetWorld(), true);
        
            // Create the widget
            PauseMenuInstance = CreateWidget<UPauseMenu>(PlayerController, PauseMenu);

            // Add to player screen
            PauseMenuInstance->AddToPlayerScreen();


        // Game is currently paused.
        case true:
            // Unpause the game.
            UGameplayStatics::SetGamePaused(GetWorld(), false);

            // Remove from player screen
            PauseMenuInstance->RemoveFromParent();
    }

To this:

switch (PlayerController->IsPaused())
    {
        // Game is currently unpaused.
        case false:
            // Pause the game.
            UGameplayStatics::SetGamePaused(GetWorld(), true);

        // Create the widget
            PauseMenuInstance = CreateWidget<UPauseMenu>(PlayerController, PauseMenu);

        // Add to player screen
            PauseMenuInstance->AddToPlayerScreen();


        // Game is currently paused.
        case true:
            // Unpause the game.
            UGameplayStatics::SetGamePaused(GetWorld(), false);

        // Remove from player screen
            PauseMenuInstance->RemoveFromParent();
    }

Any help would be greatly appreciated.


Solution

  • I registered this issue: RSCPP-36611 Comment indents wrong under 'case' with several rows non-wrapped with '{', '}'
    Meantime, you might want to wrap several commands under case condition into '{}'. As a workaround + for readability purpose.