How do I enforce LF line endings in Jetbrains Rider 2018.1
Asked Answered
G

1

24

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.

Giuseppe answered 7/6, 2018 at 14:10 Comment(1)
The answers here apply to your case: intellij-support.jetbrains.com/hc/en-us/community/posts/…Seersucker
C
40

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.

Czechoslovak answered 8/6, 2018 at 17:12 Comment(4)
I know. I tried that. I edit the file again and it switches back to CRLF again although I set it to LF before.Giuseppe
@Giuseppe If you go to Code Style, there should be a "Scheme" dropdown at the top where you can select "Default (IDE)" or "Project". Perhaps one of them has line endings still set to CRLF and is overriding the other?Czechoslovak
Just a warning for Unity3D users - setting the line endings for files can trigger a global asset reimport without warning, which can take ages and it just a pain.Keppel
I had this same issue and finally figured out that the .editorconfig file for the project had. end_of_line = crlf this was silently overrides rides settings.Brainwash

© 2022 - 2024 — McMap. All rights reserved.