piuccio / sublime-esformatter

JavaScript formatter plugin for Sublime Text
MIT License
28 stars 20 forks source link

Obey EndOfFile esformatter rule #69

Closed alavers closed 8 years ago

alavers commented 8 years ago

I noticed sublime esformatter was removing the trailing newline at the end files, in spite of the fact that I have before.EndOfFile set to 1 in my .esformatter.

I found the culprit in this plugin. The offending line of code predates the EndOfFile option which was introduced here: https://github.com/millermedeiros/esformatter/issues/111 so it seems the regex replacement may no longer be necessary.

With this change sublime-esformatter will obey esformatter's decision on EOF newlines.

But if there was another good reason for removing trailing newlines, feel free to close this PR :)

piuccio commented 8 years ago

I think that expression was needed because when you format a single block of code instead of the whole file, you end up with an extra line break. Do you mind trying?

alavers commented 8 years ago

Yes you're right, good call. Updated the PR to take that into account.

piuccio commented 8 years ago

Sorry, I totally forgot about this