Use something like showMessage to report that GHC is not available, and suggest installing it, when starting hie.
This would help in cases such as https://github.com/alanz/vscode-hie-server/issues/181
This is related to https://github.com/mpickering/haskell-ide-engine/issues/60 and it should not happen at all. We want to support stack-only projects with no ghc on the path.
@fendor I agree, but perhaps we should improve our error-reporting anyway, for those cases where this sort of thing does happen.
It seems to me that the majority of errors reported from vscode relate to readCreateProcess, and it only ever appears in the log.
So turning a readCreateProcess failure into a showMessage of what the command is that failed would help users understand the problem.
Absolutely. However, I dont know where this error is coming from, it should not be hie-bios.
And a lot of the failing process calls are from some internal library over which we do not have that much control, afaik.
Found the problem and it is not pretty:
https://github.com/haskell/haskell-ide-engine/blob/master/hie-plugin-api/Haskell/Ide/Engine/PluginsIdeMonads.hs#L348
The function BIOS.withGhc needs the system lib dir, which it retrieves with: ghc --print-libdir in https://github.com/mpickering/hie-bios/blob/master/src/HIE/Bios/Environment.hs#L54.
possible work arounds:
cc @mpickering
Personally, I would prefer (1) but I am not sure that the architecture permits it, since we are starting the server before searching for the cradle. We could probably patch it, though.
It seems to me that it would be good to have a dedicated part in the server startup to validate all runtime dependencies, including all executables and data files and report the result of them, as an alert error or as debug message if the validation passes.
It would suppose duplicate checks done for low level components but i think it will help us to make the reporting and to have explicitly in one place the runtime dependencies.
In this case, i think hie-bios should trigger lazily the searching of the cradle to get the ghc lib path and no assume it exist before that- (Not sure it it makes sense 馃槃)
It makes sense, but the problem is, that the ghc-lib path is needed when the ghc thread is started, which happens when the server starts.
What's the consensus on this? Should stack projects have an equivalent version of GHC installed globally?
That is the work around, the pr #1496 fixes the issue.