Can I disable inconsistent line ending auto fix?

I'm working in a big team and the line ending of scripts is often inconsistent due to mac/windows editing.

I wanted to prevent rider from automatically change the line ending on save since it makes my merge resquests very hard to read. I think it should be normal when I do format the file, but it should at least ask for it if it wants to do it automatically.

Can you help me find this option if it even exists.

Sam.

0
5 comments

Hello,

Rider does not edit the line endings of files on saving by default. It seems that you have .editorconfig in your project.

Would you mind checking if you have it? 
With this example:

[wwwroot/css/*.css]
end_of_line = lf

Once the .css file under `wwwroot/css/` is modified and saved, the line endings are updated to lf for this file.

The files that you create are being created with the line endings, defined from `File | Settings | Editor | Code Style`, but `.editorconfig` does override this setting on file save if the filename matches some pattern set in a config file.

There are different approaches how to manage the line endings in a multi-OS working environment. A different approach is to manage it via Git.
Might it be you use both approaches somehow, so they are conflicting?

0

Hi Dimitry!

Yes we found a way to handle this with git by making a formating commit before doing any change. Its not very fun, but it does the job.

One thing that I could suggest as an imporvement for this special case would be to implement a feature similar to the advanced saving options inside visual studio. I found out that when opening a file it'll tell you immediatly that the end of lines are inconsistent and ask for permission to fix it.

Sam.

0

Hi Smasson99

Could you please try to change the `Line Separator` setting to a proper one in `File | Settings | Editor | Code Style` and check if it helps? Thank you! 

0

I can only select a line-ending. But in the Project there are some files with CR/LF and some LF only. We would need a setting like “unchanged” or “auto-detect”.

0

Hey Kai, 

The Line Separator setting under File | Settings | Editor | Code Style  applies to new files only. You can set a different line-ending for existing files or directory:

Change line separators for the current file

Click the widget and select another line separator style.

Change line separators for a file or directory

In Soltuion view window, select a directory. In the main menu, go to File | Line Separators, and then select a line-ending style from the list. The new line-ending style will be applied to all nested files recursively. 

 

Regards,

Tom

0

Please sign in to leave a comment.