-
Notifications
You must be signed in to change notification settings - Fork 167
Formatting removes blank lines depending on if they have spaces on them #919
Comments
Do you also see that when running |
@lnicola No, cargo fmt works fine (just strips the whitespace). That runs rustfmt, right? I opened an issue on their board initially because I thought it was their issue, but then they rightly said it was not, and I can't figure out what's causing it. I have yet to replicate it with a terminal command. |
Yeah, I tried to reproduce it, but thought you might have a different I'm not sure why RLS would do this -- I thought it links to the |
I just tried out of curiosity, and if you have "trim trailing whitespace" on in the vscode settings, this won't happen, since it trims the whitespace first before running whatever formatter (which is also a nice workaround for me to use :p) |
Yeah, that's a good workaround. But may I suggest giving https://marketplace.visualstudio.com/items?itemName=matklad.rust-analyzer a spin? It does have some limitations, but some users are quite happy with it (and it auto-formats by running |
I used rust-analyzer before, and I don't remember why I switched. I do just want to support the most popular extension because it's a barrier to entry if the default option for new Rust developers is just worse... I'm a little confused why you'd recommend not using the extension as a solution to the issue, are you not affiliated with this project? |
I'm a
|
I guess we're both looking for the same thing, I'll try rust-analyzer and contribute feedback there if I figure out why I moved away in the first place. This issue certainly doesn't happen there. Thanks! |
Something like:
With a space on line 2, line 2 gets removed, but without a space, it stays. I'm not entirely sure what tool this issues is related to but it's very easy to reproduce on my setup and it seems I'm just using this extension to format and nothing else.
The text was updated successfully, but these errors were encountered: