How to NOT remove whitespaces on completion?

Answered

Hello

I just started using Rider a few days ago and I have a problem that drives me crazy.

Every time I use the auto completion, Rider removes the trailing spaces on the adjacent lines.

Here is a GIF showing the behavior.

 

I tried configuring Code Style > C# > Spaces > Preserve Existing Formatting > Extra space inside to Leave all extra space

I also set Editor > General > Strip trailing spaces on Save to None

That didn't change anything.

How can I fix this?

Thanks

3 comments
Comment actions Permalink

Hi! 

Tabs/spaces on empty lines are stripped on saving if Strip trailing spaces on Save is enabled in Preferences | Editor | General or during code reformatting. However, they always add again on hitting Enter: if Smart Indent is enabled in Preferences | Editor | General | Smart Keys, a new line is indented according to code style preferences or aligned with previous otherwise. 

Unfortunately, the option to leave spaces is not supported yet. Once RSRP-466519 is resolved, the fix will be available in Rider. We would appreciate it if you would upvote it to bring increased awareness to the issue.

 

0
Comment actions Permalink

I am experiencing this too, and it's a major workflow problem. We rely on being able to go back and track changes in git, without having to sift through huge amounts of whitespace-only noise.

Is there a way to make Rider apply all of these whitespace changes in one shot, to the entire codebase, so we can get it over with? Hopefully that would allow future changes to go in cleanly.

0
Comment actions Permalink

Dave,

To delete all trailing spaces at once you can do the following:

1. Set "Strip trailing spaces on save" to "All" and enable "Delete trailing spaces on caret line" in "File | Settings | Editor | General".

2. Force save all for all files via "File -> Save All"

Please let me know if you have any questions.

0

Please sign in to leave a comment.