mihai-vlc / sublime-jsfmt

jsfmt plugin for Sublime Text
MIT License
477 stars 21 forks source link

Weird formatting behavior on delete line. #42

Closed glorieux closed 8 years ago

glorieux commented 8 years ago

Hi,

I've got a weird behavior when using the plugin in autosave mode.

Here is the result after the first time I press save:

if (seasonKeys.length > 1 && formattedSeasons["-1"]) {
    formattedSeasons["1"] = (formattedSeasons["1"] || []).concat(formattedSeasons["-1"]);
    delete formattedSeasons["-1"];
}

Nothing unusual.

Here is the result after the second save:

if (seasonKeys.length > 1 && formattedSeasons["-1"]) {
    formattedSeasons["1"] = (formattedSeasons["1"] || []).concat(formattedSeasons["-1"]);
    delete formattedSeasons["-1"]
    ;
}

You can notice that the semicolon is placed on an extra line.

I've tried removing things from the config but nothing works. I've also tried running the document directly through jsfmt and it was behaving as expected. I'm using the default configuration and a project .jsfmt containing a single indent option set to 4 spaces.

Do you have any idea what might cause that issue or how to fix it ?

mihai-vlc commented 8 years ago

It looks like it was a bug in esformatter https://github.com/rdio/jsfmt/issues/165 I will update jsfmt and the issue should be fixed in a couple of hours.

glorieux commented 8 years ago

Thanks for your reactivity!!