commercialhaskell / stack-ide

Stack-based JSON interface to ide-backend
98 stars 23 forks source link

Stack commands hang in Emacs #97

Closed muhuk closed 8 years ago

muhuk commented 8 years ago

Any stack related commands I use, hangs indefinitely. Until I C-g.

I am using (Debian Stretch) emacs24 24.5+1-6+b2, haskell-stack 1.0.0-1, haskell-mode 13.14.2-1.

$ ~/bin/stack-ide --version
Version 0.1.0.0, Git revision f3481e239dde9817152ec00e32bfc3ebf5aaf2cb (178 commits) X86_64

Steps to reproduce:

  1. Created an empty stack project:

    cd ~/tmp stack new repro

  2. Opened ~/tmp/repro/src/Lib.hs
  3. Added:

    f = 1 g = f

  4. On the 2nd f did M-.

This is the contents of *stack:repro*:

Stack backend isn't ready. Waiting (0 attempts) ...
Flycheck tried to use the Stack backend, but the Stack backend isn't started yet. Starting it ...
Set initial command.
Starting: ("stack:repro" nil "stack" "ide" "start" "repro")
<- {"tag":"ResponseWelcome","contents":[0,1,1]}
<- {"tag":"ResponseLog","contents":"[Info] Initializing ide-backend session @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.Update ./IdeSession/Update.hs:197:3)\n"}
<- {"tag":"ResponseLog","contents":"[Debug] Session dir = /home/muhuk/tmp/repro/session.7700 @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.Update ./IdeSession/Update.hs:210:3)\n"}
<- {"tag":"ResponseLog","contents":"[Debug] Dist dir = /home/muhuk/tmp/repro/.stack-work/dist/x86_64-linux/Cabal-1.22.5.0 @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.Update ./IdeSession/Update.hs:212:3)\n"}
<- {"tag":"ResponseLog","contents":"[Debug] Local working dir = /home/muhuk/tmp/repro @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.Update ./IdeSession/Update.hs:219:17)\n"}
<- {"tag":"ResponseLog","contents":"[Info] Searching for ide-backend-server on this path: /home/muhuk/tmp/repro/.stack-work/install/x86_64-linux/lts-4.1/7.10.3/bin/:/home/muhuk/.stack/snapshots/x86_64-linux/lts-4.1/7.10.3/bin/:/home/muhuk/bin:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:319:5)\n"}
<- {"tag":"ResponseLog","contents":"[Info] Found ide-backend-server - using this one: /home/muhuk/bin/ide-backend-server @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.RPC.Client ./IdeSession/RPC/Client.hs:321:5)\n"}
<- {"tag":"ResponseLog","contents":"[Debug] Recompile required, starting... @(ideba_AQL0jV7ye7m6KoLBkUEu4S:IdeSession.Update.ExecuteSessionUpdate ./IdeSession/Update/ExecuteSessionUpdate.hs:223:5)\n"}
Running Flycheck with Stack backend ...
[flycheck Lib.hs] ~> {"tag":"RequestUpdateSession","contents":[{"tag":"RequestUpdateTargets","contents":{"tag":"TargetsExclude","contents":["repro-0.1.0.0: configure","Configuring repro-0.1.0.0...","repro-0.1.0.0: build","Preprocessing library repro-0.1.0.0...","[1 of 1] Compiling Lib              ( src\/Lib.hs, .stack-work\/dist\/x86_64-linux\/Cabal-1.22.5.0\/build\/Lib.o )","In-place registering repro-0.1.0.0...","Preprocessing executable 'repro-exe' for repro-0.1.0.0...","[1 of 1] Compiling Main             ( app\/Main.hs, .stack-work\/dist\/x86_64-linux\/Cabal-1.22.5.0\/build\/repro-exe\/repro-exe-tmp\/Main.o )","Linking .stack-work\/dist\/x86_64-linux\/Cabal-1.22.5.0\/build\/repro-exe\/repro-exe ...","repro-0.1.0.0: copy\/register","Installing library in","\/home\/muhuk\/tmp\/repro\/.stack-work\/install\/x86_64-linux\/lts-4.1\/7.10.3\/lib\/x86_64-linux-ghc-7.10.3\/repro-0.1.0.0-HuMqPgmS4mBHGmXNG0At3x","Installing executable(s) in","\/home\/muhuk\/tmp\/repro\/.stack-work\/install\/x86_64-linux\/lts-4.1\/7.10.3\/bin","Registering repro-0.1.0.0...","src\/Lib.hs",".stack-work\/dist\/x86_64-linux\/Cabal-1.22.5.0\/build\/autogen\/Paths_repro.hs"]}},{"tag":"RequestUpdateTargets","contents":{"tag":"TargetsInclude","contents":["\/home\/muhuk\/tmp\/repro\/src\/Lib.hs"]}}]}
[nil] ~> {"tag":"RequestGetSpanInfo","contents":{"spanFilePath":"src\/Lib.hs","spanFromLine":10,"spanFromColumn":5,"spanToLine":10,"spanToColumn":6}}

The last line ([nil] ~> ...) appears only after I C-g.

I would appreciate any help in debugging & fixing this.

mgsloan commented 8 years ago

Sorry, I haven't used or worked on stack ide in a long time - see the project status https://github.com/commercialhaskell/stack-ide#project-status

We will probably remove it from the stack tool, particularly once https://github.com/chrisdone/intero or https://github.com/haskell/haskell-ide-engine comes to fruition and direct stack support is added.

muhuk commented 8 years ago

Thanks for the info @mgsloan . I will try to get ghc-mod working next.

mgsloan commented 8 years ago

Good luck! Personally, I have not had success with ghc-mod. I quite like ghci-ng, though, rebranded intero yesterday - https://github.com/chrisdone/intero - and ghcid.

Stack does not yet provide a convenient way to run ghcid, but it probably will soonish. See https://github.com/commercialhaskell/stack/issues/1948

muhuk commented 8 years ago

So, are you suggesting I should try Intero AND ghcid? I am a n00b, so I don't really know what functionality either provides.

mgsloan commented 8 years ago

Yeah, intero is a replacement for ghci, whereas ghcid is something that runs ghci. Sorry for the confusion here, we are still working on building up good editor tooling.

How about just skipping intero and using ghcid + ghci?

muhuk commented 8 years ago

But do they replace stack-mode?

I am trying to interactively compile (and see errors) inside Emacs.

muhuk commented 8 years ago

Running stack install ghc-mod a few times (tweaking cabal file & stack.yml according to the errors) inside a project seems to do the work. (And I think it's not project specific now since the executable is copied to bin)

Thanks for the help @mgsloan . Stack rocks!