You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+5-7Lines changed: 5 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,6 @@ Note: `ghcide` was previously called `hie-core`.
4
4
5
5
Our vision is that you should build an IDE by combining:
6
6
7
-
8
7
<imgstyle="float:right;"src="img/vscode2.png"/>
9
8
10
9
*[`hie-bios`](https://github.com/mpickering/hie-bios) for determining where your files are, what are their dependencies, what extensions are enabled and so on;
@@ -22,7 +21,7 @@ There are more details about our approach [in this blog post](https://4ta.uk/p/s
| Go to definition in local package | definition |
24
+
| Go to definition in local package | definition |
26
25
| Display type and source module of values | hover |
27
26
| Remove redundant imports, replace suggested typos for values and module imports, fill type holes, insert missing type signatures, add suggested ghc extensions | codeAction (quickfix) |
28
27
| Organize imports | codeAction (source.organizeImports) |
@@ -49,23 +48,22 @@ It's important that `ghcide` is compiled with the same compiler you use to build
49
48
50
49
Next, check that `ghcide` is capable of loading your code. Change to the project directory and run `ghcide`, which will try and load everything using the same code as the IDE, but in a way that's much easier to understand. For example, taking the example of [`shake`](https://github.com/ndmitchell/shake), running `ghcide` gives some error messages and warnings before reporting at the end:
51
50
52
-
```
53
-
Files that worked: 152
54
-
Files that failed: 6
51
+
```console
52
+
Files that failed:
55
53
* .\model\Main.hs
56
54
* .\model\Model.hs
57
55
* .\model\Test.hs
58
56
* .\model\Util.hs
59
57
* .\output\docs\Main.hs
60
58
* .\output\docs\Part_Architecture_md.hs
61
-
Done
59
+
Completed (152 worked, 6 failed)
62
60
```
63
61
64
62
Of the 158 files in Shake, as of this moment, 152 can be loaded by the IDE, but 6 can't (error messages for the reasons they can't be loaded are given earlier). The failing files are all prototype work or test output, meaning I can confidently use Shake.
65
63
66
64
The `ghcide` executable mostly relies on [`hie-bios`](https://github.com/mpickering/hie-bios) to do the difficult work of setting up your GHC environment. If it doesn't work, see [the `hie-bios` manual](https://github.com/mpickering/hie-bios#readme) to get it working. My default fallback is to figure it out by hand and create a `direct` style [`hie.yaml`](https://github.com/ndmitchell/shake/blob/master/hie.yaml) listing the command line arguments to load the project.
67
65
68
-
Once you have got `ghcide` working outside the editor, the next step is to pick which editor to integrate with.
66
+
If you can't get `ghcide` working outside the editor, see [this setup troubleshooting guide](docs/Setup.md). Once you have got `ghcide` working outside the editor, the next step is to pick which editor to integrate with.
This page serves as a dumping ground for setup problems and their resolutions. We recommend everyone first runs `ghcide` on the console to check what files in their project load, and only the moves on to using `ghcide` through an editor (e.g. VS Code).
The cause is that your program is configured to use a different GHC to the one you built `ghcide` with. In `ghcide` you can view the version number it was compiled with on the first line as:
22
+
23
+
```console
24
+
ghcide version: 0.0.3 (GHC: 8.6.5)
25
+
```
26
+
27
+
You can see the version of GHC being used by this project in the second-last line of the output with `ghc-8.6.4/`, or in in mismatch interfaces of wanted `8065` (aka 8.6.5), got `8064` (aka 8.6.4). The solution is to use the same GHC version in both places.
28
+
29
+
## Works in `ghcide` but not my editor
30
+
31
+
Does `ghcide` alone work on the console? Did you first enter a Nix shell? Or run `stack exec ghcide`? If so, there are two options:
32
+
33
+
1. Run your editor via the same mechanism, e.g. `stack exec code`.
34
+
2. Change the extension to use the executable as `stack` and the arguments as `exec -- ghcide --lsp`.
35
+
36
+
## Issues with Nix
37
+
38
+
If you are using packages installed by Nix, then often Nix will set `NIX_GHC_LIBDIR` to say where the libraries are installed. `ghcide` can cope with that. However, sometimes the `ghc` on your shell will actually be a shell script that sets `NIX_GHC_LIBDIR`, which `ghcide` can't find. If that happens, you need to either set `NIX_GHC_LIBDIR` (so `ghcide` can see it) or use a proper [Nix compatible wrapper](https://github.com/hercules-ci/ghcide-nix) over `ghcide`.
0 commit comments