My project currently builds with GHC 8.8. Hence, I need ghcide that is built with that version of GHC. I couldn't find the specific instructions. either they aren't there, or I couldn't find them.
I cloned ghcide from here, and assumed the stack88.yaml should be used to build the correct version. So I gave the command
~
stack build --copy-bins --setup-info-yaml=stack88.yaml
~
However, I ended up with ghcide that was compiled with ghc 8.6:
~
ghcide --version
ghcide version: 0.2.0 (GHC: 8.6.5) (PATH: C:\Users\hjo20125\AppData\Roaming\local\bin\ghcide.exe) (GIT hash: 035019d5f5931af4260bd54fab1c717522aeb902)
~
Next thing I tried is to copy stack88.yaml to stack.yaml. Then build ghcide again. Now I get the expected result (which is weird, maybe somthing to do with stack?):
~
ghcide version: 0.2.0 (GHC: 8.8.2) (PATH: C:\Users\hjo20125\AppData\Roaming\local\bin\ghcide.exe) (GIT hash: 035019d5f5931af4260bd54fab1c717522aeb902)
~
Now I head over to my own project and run ghcide. It fails with the following message:
~
ghcide compiled with base-4.13.0.0-ed174a4f9b6a67f911614f3831e79151 but project uses base-4.13.0.0-76efabad708168fdf7e44222218b8976
This is unsupported, ghcide must be compiled with the same GHC installation as the project.
~
I am obviously doing something wrong here, and maybe ghcide could be too picky on the compiler version too. Both my project and ghcide use base-4.13.0.0 .
Any guidence to get me going again is very much appreciated.
You need to use the exact same stack revision as you are using in your project - my guess is you have a different GHC minor version. I'd take your snapshot and paste it at the top of the stack88.yaml file.
You might also need to do --stack-yaml instead of --stack-info-yaml, but I'm not sure.
Thanks for the response. I used a nightly for my project. This is a good reason to use LTS- snapshots.
I also got confused between --stack-yaml and --stack-info-yaml, which are obviously different.
Fortunatly I am fine now. Thanks for the awsome tool of ghcide!
FWIW, I don't see any good reason to use LTS snapshots... https://neilmitchell.blogspot.com/2015/12/whats-point-of-stackage-lts.html
I stumbled upon your blog post some time ago and it seemed very plausible to me then. However, this issue might be a reason. As a user of ghcide I need to use the same stack revision for my project as was used to compile ghcide. The project basically dictates the required ghc version. In my project's case, it should be as new as possible, but not newer (not all dependencies are fit to compile with the latest ghc yet).
I am not familiar with using several distinct versions of a tool like ghcide in case of multipel projects. It occurs to me that updating the stack revision for several projects and then have to build a ghcide with the same stack revision isn't something to do very frequently. I am curious what you think about this.
Using multiple ghcide versions at different GHC versions would be a real pain. You should be able to mix and match precise stack resolvers, as long as they have the same GHC version though - I imagine above you were mixing 8.8.2 and 8.8.3 or similar. But yeah, Ghcide might be a good reason to try and standardise!
you should be able to install ghcide locally for your project running stack build ghcide inside your project folder, and then it doesn't matter whether your project is using nightlies or LTS, as long as the snapshot does contain a working ghcide version.
Lots of interesting thoughts. I appreciate them. I use vscode on a windows machine. Would it be possible to tell vscode which ghcide to use? Currently it uses the (global) one that happens to be in the path. This more or less forces me to standardize or else use some workarounds.
It would be nice if that could be cleaned up. Perhaps make a ticket for it? Ideally we'd grab ghcide from inside the Stack folder?
As a simple workaround, VSCode allows to configure the path to ghcide on the current workspace. You can find the setting in the options for the ghcide plugin, and then make sure to edit the workspace level setting
Ah, that is a neat solution. Didn't know that one. Thought is was only a global setting. Thanks @pepeiborra for this tip.