Newline added on every save #289
Comments
I can't reproduce this. Anyway, it sounds like an issue with vscode, not HIE. Maybe make an issue on the vscode tracker? |
I thought this was the case however I can only reproduce this when using HIE. Two cases that hint at HIE being the issue:
|
I have the same issue, I think it happens when I think Brittany indents a final newline, such that the former final newline isn't regarded as the final newline anymore, and a new final newline is inserted by vscode next time the buffer is saved, which then gets indented by brittany, and the cycle repeats... |
Good catch! |
lspitzner/brittany#25 has nothing to do with this. I think @sheyll's analysis is close, although I am confused where the newline containing space comes from. It is true that brittany adds a new line if the last line contained anything in the input (even if those contents were only spaces that don't get reproduced by brittany). But this stops after one iteration, as there now is a newline character at the end of the input. So idempotency is not violated from brittany's end alone. There are two fixes to this: Stop brittany from adding a final newline and stop whatever else from adding a line containing space. I think both should be implemented. I have opened lspitzner/brittany#53. |
As it turns out, lspitzner/brittany#53 was unrelated, although it had a similar cause. Brittany never exposed any newline-appending behaviour when the But I think the cause is related: the plugin uses Text.lines instead of So now I think the fix involves not using |
Any update on this? |
Fixed with #525 |
In VSCode every time I make a change to a file and save it, a newline is added to the end of the file. Assuming you make 100 changes and save after every change, this will result in 100 empty lines added to the end of the file.
The text was updated successfully, but these errors were encountered: