Closed simonmichael closed 8 years ago
Files are not checked when you first open them, and restart counts as "first opening them". There are several reasons for this implementation decision, and I'm not likely to change that any time soon. Check status is deliberately discarded upon restart, so you don't run into issue of 'changed file in another editor, Atom still thinks there are errors'.
You see hourglass icon because it tries to pre-cache module symbols for autocompletion. Not in any way related to actual syntax-/typecheck.
Note that you can 'save' (ctrl
+s
) file even if there are no unsaved changes. If you have 'check on save' enabled, ide-haskell will run check even if there is basically nothing to save.
I must tell you this is not intuitive. As a new user, if there were errors in the file when I quit, I expect to see the same errors when I restart. There are many things which can prevent this working at all, so I think it's extra important not to add to that list.
I have no solution for this. Checking files on opening is not a good idea at all for several reasons -- I tried it back in the olden days and it didn't work well at all. Saving check state isn't a particularly good idea as well, due to reasons explained above. I'm going to close this now, but if anyone has some particularly strong feelings on this issue, feel free to comment or open a new one. I can't promise that end result will be any different though. Sorry.
This is of particular annoyance to me aswell. I'm curious why it didn't work well at all?
@pbiggar
Well, for one, whole project is never checked, only current file and its imports, with primary reason being time and memory consumption. For larger projects (e.g. Pandoc, or ghc-mod for that matter) checking whole project can take a lot of both. Now consider a case where you have like 20 tabs open on Atom start. This won't go well if you have limited RAM or slow CPU; also it'd be a ripe ground for various race conditions.
Second reason is due to immediate user experience. Since initial check can take a while, there will be a considerable lag between opening Atom/a file and actually seeing the errors. If you're rushing in to fix a bug or something, you even have time to actually change source before check finishes in many cases. Results are disorienting and confusing, to say the least.
Thanks for the reply.
So the problem I experience is that when I start up, HGM isn't running. To make it run, I need to close the tab and reopen it. I don't seem to be able to make it run any other way (including saving and changing the file).
So, I don't need every file run, and I'd be happy to have a spinner while it's getting started to deal with the race condition.
@pbiggar, update to Atom 1.9 or above? There was a bug that prevented grammar hooks from firing when restoring open documents. I had a workaround in language-haskell, but it was removed recently.
I'm on 1.10.2
@pbiggar, well, if it's a regression, then I officially hate being me.
Sanity check: do you use ide-haskell? Does its panel show up when you restart Atom with Haskell files open, or do you need to reopen a Haskell file for it to pop up? Is Haskell grammar selected for open Haskell files on restart? Do you have any other Haskell grammars installed that might interfere? I'm pressed for time right now, so I can't test this myself, sorry. Also I suggest we continue this in a new issue.
@lierdakil Sorry for the late reply. I've stopped using both Haskell and Atom, so unfortunately I don't have much more info. As I recall, the panel didn't show up - I needed to open a hs file. The grammar is selected I believe. No other haskell grammars. Hope that's helpful if this ever comes up again.
When I start Atom, files which were open previously are reopened. The panel's status icon changes briefly to the hourglass, but errors are not shown until I make a change or select Haskell IDE -> ghc-mod -> Check.