SublimeHaskell / SublimeHaskell

A Sublime Text 3 plugin for Haskell. Features cabal building, error and warning highlighting, smart completion and ghc-mod integration.
MIT License
572 stars 86 forks source link

Can't get check/lint to run. Infer types crashes hsdev #288

Closed jkeuhlen closed 7 years ago

jkeuhlen commented 7 years ago

I'm not sure if this is a bug here or over on hsdev but I've been having issues lately where the check/lint functions just run forever. The error panel never becomes available and it will continually say it's checking on the bottom of the screen. Additionally, If I try and run the infer types command, SublimeHaskell loses it's connection to the hsdev server (it looks like hsdev crashes?).

From a fresh startup:

plugins loaded
Sublime Haskell: Starting hsdev serverSublime Haskell: hsdev ping: no pong

Sublime Haskell: hsdev server started at port 4567
Sublime Haskell: connecting to hsdev server (0)...
Sublime Haskell: connecting to hsdev server (0)...
Sublime Haskell: connected to hsdev server
Sublime Haskell: connected to hsdev server
Package Control: Skipping automatic upgrade, last run at 2016-11-11 09:39:40, next run at 2016-11-11 10:39:40 or after
Sublime Haskell: hsdev ping: no pong
Sublime Haskell: listen: connection to hsdev lost: [WinError 10054] An existing connection was forcibly closed by the remote host
Sublime Haskell: callback '<unnamed>' throws exception: on_err() takes 1 positional argument but 2 were given
Sublime Haskell: listen: connection to hsdev lost: [WinError 10054] An existing connection was forcibly closed by the remote host

The close happens right when I run the infer types. It looks like other functionalities still work (tooltip for example works but not with inferred types).

Then hsdev never comes back up:

Sublime Haskell: hsdev ping: no pong

Additionally, when I open a new file I get the following error

Sublime Haskell: drop prepared completions
Sublime Haskell: hsdev ping: no pong
bscottm commented 7 years ago

@jkeuhlen: Please update the SublimeHaskell plugin (and hsdev, if necessary) and see if this issue has been fixed. I'm reasonably confident that it has been.

jkeuhlen commented 7 years ago

I updated SublimeHaskell and hsdev, but I'm still having issues. It's different, but I still can't get anything to check or lint, and most of the symptoms I had before were the same.

Here's the output of the console I see now when I try to get check to run:

24/03/17 17:42:03 -0600 INFO > connected 24/03/17 17:42:03 -0600 INFO > connected 24/03/17 17:42:06 -0600 ERROR //1/update/task/directory/task/package-db/scan> Error reading cache: IO exception while reading cache from C:\Users\Jake\AppData\Local\Sublime Text 3\Cache\SublimeHaskell\hsdev\cabal\C.Users.Jake.workspace.helloworld.stackwork.install.cf5a45a3.pkgdb.json 24/03/17 17:42:19 -0600 INFO //1/update> writing cache to C:\Users\Jake\AppData\Local\Sublime Text 3\Cache\SublimeHaskell\hsdev 24/03/17 17:42:27 -0600 INFO //1/update> cache saved to C:\Users\Jake\AppData\Local\Sublime Text 3\Cache\SublimeHaskell\hsdev 24/03/17 17:42:28 -0600 ERROR ghc> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:28 -0600 ERROR //_/update/task/docs> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:28 -0600 ERROR //_/update/task> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:28 -0600 ERROR //_/update> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:28 -0600 ERROR //_> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:28 -0600 ERROR /> Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) Sublime Haskell: listen: connection to hsdev lost: [WinError 10054] An existing connection was forcibly closed by the remote host 24/03/17 17:42:28 -0600 INFO > disconnected 24/03/17 17:42:28 -0600 ERROR > Scope leaves with exception: : cannot satisfy -package helloworld (use -v for more information) 24/03/17 17:42:36 -0600 WARN /> Invalid request {"no-file":true,"id":"3","command":"check","ghc-opts":[],"files":[{"file":"C:\\Users\\Jake\\workspace\\helloworld\\src\\Lib.hs","contents":null}]}

Again, hover tips still work (although it doesn't show any haddock style comment descriptions), and some of the other functions for hayoo/find declaration also work. I'm happy to try anything you can suggest! Or let me know if you need me to try anything else on my system.

I'm running Windows 10 if that's important at all.

bscottm commented 7 years ago

@jkeuhlen: I'm assuming that you have SublimeText3 (because I tested with SublimeText2 and the plugin doesn't work at all.)

jkeuhlen commented 7 years ago

@bscottm Yes, I'm on ST3.

I'm using stack. and everything works correctly with stack build. This example is from a dummy project where it isn't working either, I've been using SublimeHaskell for about the last year, and it worked great up until around November (a little bit before I opened this issue).

Originally I thought it was an issue with inspecting inside of git sub-modules or following local packages but it also doesn't work with the simple project (just a main and src/Lib.hs file).

I just tried Reinspect all and it seems to be stuck on "Inspecting cabal..." now.

jkeuhlen commented 7 years ago

I'm also seeing this error a lot:

Sublime Haskell: listen: connection to hsdev lost: [WinError 10054] An existing connection was forcibly closed by the remote host Sublime Haskell: listen: connection to hsdev lost: [WinError 10054] An existing connection was forcibly closed by the remote host

bscottm commented 7 years ago

@jkeuhlen: Can you step me through how you created the dummy project, so that I can try to reproduce the issue?

Also, it occurred to me that you could have a mismatch between the GHC used to compile hsdev and the GHC being used in the dummy project.

jkeuhlen commented 7 years ago

I tried updating/reinspecting all again and it looks like the checkers are running again! There is another issue I'm seeing now that looks like it is a separate issue though, do you want me to report it here or create a new issue? It's spitting out errors for modules that are defined in a local package (that comes from a submodule):

C:\Users\Jake\workspace\project\src\FileNamehs: line 15, column 1: Error: Failed to load interface for `FileName.Module' Use -v to see a list of the files searched for.

I am using an older version of GHC (stack lts-6.12 / ghc 7.10.3). Should I be hand-building hsdev with my version of ghc?

bscottm commented 7 years ago

@jkeuhlen: Yes, you need to match your GHC to your hsdev, which means you need to compile hsdev with 7.10.3.

jkeuhlen commented 7 years ago

@bscottm That makes sense, did I miss it in the readme? (if not could it be added?).

Is stack install hsdev not sufficient for building with the correct version of GHC? Do I need to clone and build instead?

bscottm commented 7 years ago

@jkeuhlen: Yes and no. Yes, it's the correct command. No, because you probably need to tell stack which resolver to use. For the 7.10.3 series, it would be something like this:

stack install --resolver=lts-6

(if I recall correctly -- haven't tried this out on my command line.)

jkeuhlen commented 7 years ago

@bscottm Thanks for the help. stack install hsdev --resolver=lts-6.12 was the correct thing for me and it looks like things are starting to behave better again. There was another issue I reported that I believe was fixed on master, if I'm on the 7.10.3 series, can I expect back-ports of bug fixes? Or should I only see those in the most recent versions on GHC 8?

bscottm commented 7 years ago

Yes, stack install --resolver=lts-6 or stack install --resolver=lts-6.30 would compile.

I did start an issue about matching GHC and hsdev, because I don't think you'll the the last person to encounter this problem.

bscottm commented 7 years ago

@jkeuhlen: That's more of an hsdev question than a SublimeHaskell plugin question. @mvoidex is pretty good about trying to keep hsdev working across the swath of compiler versions.

jkeuhlen commented 7 years ago

Original issue solved; GHC version needs to match hsdev version.