How do I enforce LF line endings in Jetbrains Rider 2018.1

Robert picture Robert · Jun 7, 2018 · Viewed 7.9k times · Source

I'm frequently running into line ending issues with my JetBrains Rider 2018.1 installation under Windows 10. The IDE turns existing LF files into CRLF files once I edit them. I haven't yet found a way to configure it the way I want.

I would like to always only have LF in my files (for new ones and for edited ones). During a commit process, I don't want to get distracted by line ending changes.

My git is set to core.autocrlf=input. So it should behave neutral and use the as-is settings.

I know I can edit each file manually via the Line Ending switch button on the bottom right of the editor, but I feel that is quite cumbersome.

Answer

andrej88 picture andrej88 · Jun 8, 2018

To change the default line ending for new files, Go to FileEditorSettingsCode Style and in the "Line Separator" dropdown select "Unix and OS X (\n)".

To change the line endings of existing files, select the files in the "Project" view panel, then go to FileLine SeparatorsLF - Unix and OS X (\n). Make sure you don't break anything though - some file formats (eg .bat) only work with specific line endings.