JetBrains Rider "Reformat code" action (Ctrl+Alt+L) removes line feed at end of file
Asked Answered
S

1

5

I am using JetBrains Rider version 2018.3.3 on Ubuntu 18.04. I have enabled the setting Editor -> General -> Ensure line feed at file end on Save. This works great when saving a previously edited .NET/C# .cs file.

However, when applying the "Reformat code" action (keyboard shortcut: Ctrl+Alt+L) which also automatically saves the file after applying the code reformat, the line feed at the end of the file is removed again.

Is this something for a bug report or is there another setting to configure the reformat action to stop this behavior?

Sulphathiazole answered 7/4, 2019 at 0:2 Comment(1)
You can create a bug report in the official issue tracker: youtrack.jetbrains.com/issues/RIDERCimbura
S
11

I found the required setting.

Checking Line feed at end of file in Settings -> Editor -> Code Style -> C# -> Line Breaks and Wrapping prevents code reformat/cleanup actions from removing the newline at the end of files.

enter image description here

Sulphathiazole answered 8/4, 2019 at 16:23 Comment(1)
Thank you. I would expect this setting to be under "blank lines" tab, a weird decision by JetBrains.Weihs

© 2022 - 2024 — McMap. All rights reserved.