Sublime Forum

How do I stop Sublime from removing extra empty lines?

#1

I often use multiple empty lines to separate different sections within the code I’m writing. It helps me manage a learning disability. When I save, Sublime removes those extra lines. That would be a good thing, except that I have a good reason for inserting those lines. Is there a way for me to configure Sublime to leave those lines where I put them? Note that I’m using Rust Enhanced. Could the problem be with it?

Thanks!

0 Likes

#2

The Sublime Core only has the ability to trim trailing whitespace on save (any white space between the last non-space character and the newline) but that does not remove lines physically from the file.

Does this happen in all files, or only some files (e.g. Rust?)

Based on your mention of Rust Enhanced, my guess would be that when you save the package formats your file for you to meet some coding standard, which could well be redacting away empty lines.

A way to double check would be to start Sublime in Safe Mode and try to save a file where you see this issue and see if the issue persists there or not.

0 Likes

#3

Yes, I think you are right that it is some other package causing me trouble. I checked through the settings for Rust Enhanced and didn’t find any setting that would affect the way I use blank spaces. However, I also use the Rustfmt (Rust Format) package and I’ll bet that’s the source of my issue. I checked the settings for it, too, without finding anything I could change to solve my problem, but I’ll still bet that’s where I have to look. I’ll post over on the Rust Language forum and see if anyone there can help me.

Thanks for responding and giving this a try! :>)

0 Likes