Closed thblt closed 8 years ago
Actually, I believe that's a bug, since linting and checking a file that has not been saved should be possible. I think that should be happening only on empty nonexistent files, since Atom generally reports nonempty nonexistent files as "changed", and that should work. Please correct me if I'm wrong.
Thanks for your answer ! I've done some more testing:
Sorry, I haven't even tested if linting worked despite the error — my mistake.
The problem seems to be a bit more complicated than I initially reported. Ghc-mod behaves differently with non-existing files, depending on whether they've been named or not.
atom myfile.hs
), I get linting, but no error checking. Checking starts immediately after the first save.I tested with the following code:
a = (2)
a = (3)
In the first case (File/New File, set type to Haskell), I get neither linting nor error checking. In the second case, I get correct notices about the redundant parentheses, but nothing about the duplicate declaration of a
, which only appears after I save the file.
Um. What version of ghc-mod do you use? Any named files should pretty much work with 5.4.0.0 and up. Not so sure about earlier versions (and 5.3.0.0 is pretty much broken, so I don't support it)
Also, "unnamed" files would be hard to check, due to some inherent limitations of GHC API (basically I'd have to guess filenames, which is less than optimal -- and I don't think that's really necessary to have this working anyway). More user-friendly message might be in order though.
$ ghc-mod --version
ghc-mod version 5.4.0.0 compiled by GHC 7.10.2
Installed with Homebrew's cabal, on OSX 10.11. Same behavior on Linux.
Also, "unnamed" files would be hard to check, due to some inherent limitations of GHC API (basically I'd have to guess filenames, which is less than optimal -- and I don't think that's really necessary to have this working anyway).
I agree with that.
Sorry about the holdup, I'm currently very short on time.
A couple more questions, if you don't mind. Do you use ide-haskell, or linter frontend? If latter, check is only performed on save, due to it being rather slow, while linting is on-the-fly. I probably should skip lints for empty buffers altogether. If former, then I'm not sure what's going on.
Okay, so 0.9.14 shouldn't attempt to lint empty buffers, which will suppress error message. Please confirm that it works out for you.
Thanks! I'm testing with 1.0.0 right now.
Just noticed a small cache issue: when reopening a file, the linting messages and errors appears as they were when it was last closed in Atom, even if it has been modified since.
Besides that, using Linter, everything seems to work : no error message when the file doesn't exist, linting on the fly, check on save.
Using IDE-Haskell, I'm only able to get linting and error checking on save. Maybe I'm missing a setting somewhere?
Sorry for late reply. I just released a version that has check/lint on change with ide-haskell. Bear in mind that checking on change can be very slow, so tread lightly. (you need to enable 'On Change Check/Lint' in haskell-ghc-mod settings, and it's not available for linter right now)
I believe cache issue is with linter package, although it can also happen with ide-haskell. I can't say I'm terribly inclined to fix this, due to it being basically self-correcting, and watching files for changes would be relatively hard (TL;DR not worth fixing IMO)
This issue can be closed I think.
When editing a non-existing file (this may happen when invoking Atom from command-line, eg.
atom nonexisting.sh
), haskell-ghc-mod displays an error:Although the error is normal, I believe it would be nicer to postpone linting and display a simple notification ("ghc-mod won't work until this file is saved.") rather than this quite alarming message that doesn't go away.
Thanks,