Atom Editor Race Condition (elm-format on save)

50 views
Skip to first unread message

Duane Johnson

unread,
Oct 20, 2016, 4:39:44 AM10/20/16
to elm-d...@googlegroups.com
I have my Atom Editor configured with the following plugins:
- atom-beautify
- language-elm
- linter
- linter-elm-make

The atom-beautify plugin is configured to "Beautify On Save". Normally, after I save an elm file, they elm-format step is triggered, and the linter tells me if there are any errors. I've learned to trust these awesome elm compiler messages.

Occasionally, after larger edits, I save my file and the linter reports a spurious error. If I save a second time, the error goes away and I get the green "[checkmark] No Issues".

Has anyone else seen this? I'm guessing that some kind of race condition exists between one or more of these packages, so that when I save, one part of the checking occasionally finishes before the other. However, I'm not well-versed in the details of these packages to know what might be racing.

Thanks,
Duane Johnson

Rupert Smith

unread,
Oct 20, 2016, 5:50:51 AM10/20/16
to Elm Discuss
I found linter-elm-make to be glitchy as hell. It reports issues that are not there any more, then after a lengthy update of maybe up to a minute it finally catches up. Its really not a usable experience at all. It is useful, particularly its ability to point out unused imports. I disabled it and only enable it occasionally when I am having a bit of a tidy up. 

John Orford

unread,
Oct 20, 2016, 5:57:41 AM10/20/16
to Elm Discuss
My Atom (stable & beta) borks with nothing open on Ubuntu 1604... Doubt it's Elm-related in my case, irksome : /

VS Code / Light Table ftw...


--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

halohalospecial

unread,
Oct 20, 2016, 6:11:23 AM10/20/16
to Elm Discuss
Hi!

After invoking the "save" command, `linter-elm-make` will execute the elm-make process behind the scenes (the specific event in Atom is `onDidSave`).  AFAIK, `atom-beautify` is also waiting for the `onDidSave` event.  It now depends on which of these 2 packages will handle that event first and which will finish first since they are both are async (using promises).

I would suggest using https://atom.io/packages/elm-format instead.  The difference with `atom-beautify` is that `elm-format` (the Atom package) listens on `onWillSave` instead (triggered before saving) and waits for the elm-format process to finish (sync).  It is then guaranteed that the code will be formatted before linting kicks in.  If you still experience the same behavior, try submitting an issue to `linter-elm-make`.

Cheers!

Duane Johnson

unread,
Oct 20, 2016, 6:17:46 AM10/20/16
to elm-d...@googlegroups.com
Thanks for the explanation and suggestion! I have `elm-format` (the atom package) installed now.

--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages