Formatting Question C++



I am trying to fix an issue where if I do the if macro it's fine it would like this: 

if (true)


but if I just type it myself which is what I always do it looks like this 



while visual studio would correct this and add the space Rider never fixes that and I've looked everywhere in the formatting to try and fix it but nothing seems to help. Is this fixable? 



Unfortunately, auto-formatting on the closing brace is not yet supported. We have a feature request in YouTrack: You can vote or follow the ticket to get a notification when it is implemented.


If you're experiencing formatting issues with Rider and it's not automatically correcting spaces in your if statements as Visual Studio does, you might want to check and adjust the code formatting settings. Here's how you can do it:

Go to Settings:

  • Open Rider.
  • Go to "File" > "Settings" (on Windows/Linux) or "Rider" > "Preferences" (on macOS).

Adjust Code Style Settings:

  • In the settings window, navigate to "Code Style" > "C#" > "Formatting Style."

Modify Spaces in Control Statements:

  • Under the "Spaces" tab, find the "Within 'if', 'for', 'while', 'switch', etc." section.
  • Adjust the settings based on your preference. It might include options for "Before '('" and "After '('."

Apply Changes:

  • Click "Apply" or "OK" to save the changes.

If Rider is still not behaving as expected, there might be some specific settings that are conflicting or not configured correctly. You might need to explore the Rider documentation or forums for more advanced troubleshooting.

Additionally, make sure that Rider is recognizing the file as a C# file and that there are no conflicting plugins or external formatting tools affecting the behavior.





Please sign in to leave a comment.