Closed isao-takejib closed 4 years ago
Probably you dont have a hie server compiled with the same ghc used by the project you are trying to open.
If you have all settings by default the vscode extension tries to find an executable hie-wrapper
that in turn needs a specific hie-${ghcVersion}
executable.
You should install the last one executble with stack install.hs hie-${ghcVersion}
in the hie project root, being ${ghcVersion}
the ghc used by the project at hand.
If you are using stack you can get the ghc version used in the project running stack ghc --version
in the project root (where stack.yaml
is placed)
You are probably using stack, have no "ghc" on the PATH, and did not open the project in your editor with the right workspace-root? What you should be doing is something like:
cd <project-root>
code . # Or lsp-client of choice
You can also try:
cd <project-root>
hie-8.6.5 --debug
and link the produced logs here.
I don't have "ghc" on the path because it was installed with stack and should be run as "stack ghc" I suppose. So does it mean that I am not able to use hie when I am not in a project folder and just want to use code editor?
Running HIE(hie-8.6.5)
Version 1.0.0.0, Git revision 904ece931c908109419c7fe8c6e034e529e91131 (3656 commits) x86_64 ghc-8.6.5
To run as a LSP server on stdio, provide the '--lsp' argument
Current directory:/home/u473t8/Projects/Test
args:["--debug"]
Looking for project config cradle...
2020-02-21 00:15:47.4852333 [ThreadId 4] - Cabal-Helper found these projects: []
2020-02-21 00:15:47.48576118 [ThreadId 4] - These projects have the build tools installed: []
2020-02-21 00:15:47.485822721 [ThreadId 4] - Could not find a Project for file: /home/u473t8/Projects/Test/File.hs
2020-02-21 00:15:47.485886157 [ThreadId 4] - Module "/home/u473t8/Projects/Test/File.hs" is loaded by Cradle: Cradle {cradleRootDir = "/home/u473t8/Projects/Test", cradleOptsProg = CradleAction: Direct}
2020-02-21 00:15:47.486099566 [ThreadId 4] - Use Plain GHC
2020-02-21 00:15:47.490184164 [ThreadId 4] - `ghc --numeric-version`: Exit failure: 127, stdout: , stderr: /bin/sh: ghc: command not found
2020-02-21 00:15:47.490266494 [ThreadId 4] - Command `ghc --numeric-version` failed.
2020-02-21 00:15:47.490317332 [ThreadId 4] - GHC Output: "Nothing"
2020-02-21 00:15:47.490413737 [ThreadId 4] - Use Plain GHC
2020-02-21 00:15:47.495002887 [ThreadId 4] - `ghc --print-libdir`: Exit failure: 127, stdout: , stderr: /bin/sh: ghc: command not found
2020-02-21 00:15:47.495099627 [ThreadId 4] - Command `ghc --print-libdir` failed.
2020-02-21 00:15:47.49516262 [ThreadId 4] - GHC Output: "Nothing"
2020-02-21 00:15:47.495206856 [ThreadId 4] - Could not obtain the libdir.
###################################################
Cradle: GHC session
Project Ghc version: No System GHC Found.
Libdir: Nothing
Searching for Haskell source files...
Found 1 Haskell source files.
###################################################
Found the following files:
/home/u473t8/Projects/Test/test.hs
Load them all now. This may take a very long time.
hie-8.6.5: /home/u473t8/.local/lib/settings: openFile: does not exist (No such file or directory)
So does it mean that I am not able to use hie when I am not in a project folder and just want to use code editor?
I think to have ghc in $PATH is needed to open a standalone file for now.
Maybe we could fallback to use stack ghc
instead ghc
if stack is installed and there is no GHC available.
Instead of specifying project root, another directory was specified. When I specified the project root, it worked fine. Thanks for your advice. Thank you very much !
Using HIE with VS Code gives the following error:
Is there anything wrong? Where are the settings to look at?