Open shengc opened 8 years ago
Does the plugin support the latest idea (2016.1.1) ? There are couple of exceptions like below in the event log, though I have configured both the compiler and tools in preference.
ghc
Failed to create process for command: "" --numeric-version
Caused by: com.intellij.execution.ExecutionException: Executable is not specified
cabal
Failed to create process for command: "" --numeric-version
Caused by: com.intellij.execution.ExecutionException: Executable is not specified
I included the ghc in the PATH, now the event log shows another error,
ghc
Nonzero exit status (1) from command: /usr/local/bin/stack --stack-yaml /Users/shengc/Documents/workspace/haskell/hpffp/stack.yaml ghc -- --numeric-version
Process stderr: After installing Cabal, the package id couldn't be found (via ghc-pkg describe Cabal). This shouldn't happen, please report as a bug
Configure
the --
between ghc
and --numeric-version
caused the error message. But again, it should not check ghc
or cabal
since the compiler is using stack
@shengc - Have you checked out the Haskell Tools Console? It might give you some additional information. Paste any info you see here (or in a gist if it's a lot).
HaskForce should be compatible with 2016.1.1, but I'll dig in tomorrow to see if I can reproduce your issue.
Also, can you provide the version of ghc-mod that you are using?
@carymrobbins The output in the console is not so much different from what I just pasted, but anyway there you go,
list
check *******.hs
check *******.hs
Using working directory: ********
Starting ghc-modi process: /usr/local/bin/stack exec -- /Users/shengc/.local/bin/ghc-mod legacy- interactive
type *******.hs 75 2
ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist (No such file or directory)
I am using stack
1.0.4, ghc
7.10.3, and ghc-mod
5.5.0.0 on OS X 10.11.4
@carymrobbins I also noticed that if I Ctrl clicked (well, it was actually "Command clicked") on a function coming from Prelude
or a dependency, the UI would completely freeze. I had to send SIGKILL
to terminate idea and restarted.
Sorry for the late delay!
The output in the console is not so much different from what I just pasted, but anyway there you go
One thing that stands out to me is the spacing in the legacy-
and interactive
. You may want to check your Haskell Tools configuration to ensure that the command line options are correct (should be legacy-interactive
for ghc-modi).
I'd also run the following and post back to confirm the existence of the executable -
$ [ -f /Users/shengc/.local/bin/ghc-mod ] && echo exists || echo missing
$ [ -x /Users/shengc/.local/bin/ghc-mod ] && echo executable || echo not executable
I also noticed that if I Ctrl clicked (well, it was actually "Command clicked") on a function coming from Prelude or a dependency, the UI would completely freeze. I had to send SIGKILL to terminate idea and restarted.
If this happens, you could also run -
$ jps -l | grep intellij
8143 com.intellij.idea.Main
$ jstack 8143 > stacktrace.txt
Then post the resulting stacktrace.txt
to a gist and link to it. From there that should give some insight as to exactly what is causing the freeze. I'm thinking it's probably the parser.
Just leaving a comment here because I spent several hours today pulling my hair out trying to make this work, and came across this thread in the process:
If you're getting the ghc-mod: cabal: readCreateProcess: runInteractiveProcess: exec: does not exist
error on Mac OS X, one possible cause is that the stack
executable is not in the PATH
used by IDEA, since it's a GUI app. (This is almost certainly the case if you installed stack to /usr/local/bin
or ~/.local/bin
and haven't gone through extraordinary lengths to override the path used by OSX GUI apps.) If ghc-mod
doesn't find the stack
executable, it falls back to cabal
as the build system, generating that error message.
To fix this, supply the --with-stack=/path/to/stack
parameter to ghc-mod
in Preferences -> Other Settings -> Haskell Tools
.
@carymrobbins: It might be a good idea to have Haskforce supply the --with-stack
or --with-cabal
parameters automatically, since it knows which build system you're using and where the executable is located as part of its own setup process.
@danielstory Although you have identified the problem (stack path on OS X), I could not get it to work by passing the --with-stack=/path/to/stack
as a parameter to ghc-mod. I did however succeed by making a symlink from /usr/bin
(an insecure hack, but confirmed the issue).
Note that when when using stack, ghc-mod is executed in the context of stack, semantically -
% stack exec -- ghc-mod <args>
@DanielG - Should --with-stack
work to solve this issue? It seems that it is working for some (@danielstory) but not others (@jasoncorso). I could update HaskForce to use this flag, but I'm not sure if that would actually solve the problem at the moment. Although, I seem to recall the possibility of ghc-mod using the STACK_EXE
environment variable that stack provides.
In the interim, one possible workaround would be to use a script to take care of this.
stack-wrapper
#!/bin/bash
stack_path=/usr/local/bin/stack
stack_dir=$(basename "$("$stack_path" exec -- bash -c 'echo $STACK_EXE')")
export PATH=$PATH:$(basename "$stack_exe")
exec "$stack_path" "$@"
Then you could configure IntelliJ to use path/to/stack-wrapper
instead of stack. It's a bit of a hack, but may help until we have found the right solution.
Yes --with-stack
should fix this if the problem is stack
not being in PATH
. The stack exec -- ghc-mod ...
thing only works properly with >5.6 though where I added some code to check if STACK_EXE
is set and actually exists.
What I don't understand is why it still tried to look for
cabal
since I have configured the project to usestack
. Besides I ran the type command in aghc-modi
session opened by myself, and the output was sane,