Repository navigation
fix: keep the final newline of markdown files on save - #4220
Conversation
110370d to
4c17acc
Compare
|
Works great, but I wonder if all that extra hassle is really worth it just to remember a new line 🤔 we could also think about keeping the behaviour as |
Yes I agree it's quite the edge case, although it would be nice for our editor to preserve the original file. @kulmann I'd leave it up for you to decide if it's worth the added logic. There is also a simpler solution that doesn't take the source view into account (bullet point 3 above), but that feels like a half baked solution. |
|
I agree that it's quite the change for a seemingly small improvement. But anything about newlines is a PITA from a users perspective, so I think preserving the original newline behaviour at the end of the file is a good thing. |
c2a2d80 to
ea1c0bd
Compare
kulmann
left a comment
There was a problem hiding this comment.
would it make sense to strip all trailing newlines and then only add exactly one \n if a newline at EOF is supposed to be set?
As briefly discussed in chat: let's preserve the user's input, since this is not a code editor that profits from the 1-newline-rule. |
ea1c0bd to
2c7bdb0
Compare
Description
Saving a Markdown file in the text editor dropped its final newline, because the editor document can't hold it and the Markdown serializer doesn't reliably write one.
setFinalNewline()onTextEditorInstancemakes this possible.Related Issue