... | ... | @@ -35,8 +35,14 @@ Build GHC in the context defined by `ghc.nix` and `shell.nix`, e.g. |
|
|
nix-shell --command 'hadrian/build.sh -c -j12 --docs=none --flavour=Devel2'
|
|
|
```
|
|
|
|
|
|
**N.B.**: Probably we do not need a full build to use the IDE tooling, because source files are generated pretty early. However, you likely - sooner or later - want to have a fully built GHC: To run tests, do manual testing, etc..
|
|
|
|
|
|
## Create `compile_commands.json` (C IDE support)
|
|
|
|
|
|
`ccls` needs a [`compile_commands.json`](https://clang.llvm.org/docs/JSONCompilationDatabase.html) (*JSON Compilcation Database*) file as configuration. This file is mostly a mapping of `*.c` filenames to C compiler arguments.
|
|
|
|
|
|
`compile_commands.json` is generated by [`bear`](https://github.com/rizsotto/Bear), a tool that intercepts all calls to the C compiler.
|
|
|
|
|
|
```
|
|
|
nix-shell -p bear --command 'bear hadrian/build.sh -j12 --freeze1 --flavour=Devel2 stage2:lib:rts'
|
|
|
```
|
... | ... | @@ -66,11 +72,24 @@ The simplest way is to: |
|
|
|
|
|
The folder of your GHC compiler workspace is the source root of the cloned GHC repository. The Hadrian folder, is `hadrian/` in that previously described folder.
|
|
|
|
|
|
So, e.g. if your GHC source folder has the path `/home/sven/src/ghc`, then the two folders are:
|
|
|
- **`/home/sven/src/ghc`** for GHC
|
|
|
- **`/home/sven/src/ghc/hadrian`** for Hadrian
|
|
|
|
|
|
Some animations to demonstrate what you can expect:
|
|
|
|
|
|
![Haskell - Hover](uploads/8d364182c4feec961cbbf0eeb7a4e2ca/peek_vscode_haskell_hover.gif)
|
|
|
|
|
|
![Haskell - Quickfix](uploads/49faab281021bcc257e9ba490df8cccc/peek_vscode_haskell_quickfix.gif)
|
|
|
|
|
|
![C - Hover & Error](uploads/160b19edec2d0b40789afd23f65e1cb4/peek_vscode_c_hover_error.gif)
|
|
|
|
|
|
|
|
|
## Plugin configuration
|
|
|
|
|
|
### `ccls`
|
|
|
|
|
|
Works out of the box! It automatically finds the [`compile_commands.json`](https://clang.llvm.org/docs/JSONCompilationDatabase.html) (*JSON Compilcation Database*) file and uses it as configuration.
|
|
|
Works out of the box! It automatically finds the `compile_commands.json` file and uses it as configuration.
|
|
|
|
|
|
### `ghcide`
|
|
|
|
... | ... | @@ -80,4 +99,6 @@ You have to set them per workspace, i.e. `hic.arguments` differs for the GHC com |
|
|
| Workspace | `hic.arguments` | `hic.executablePath` |
|
|
|
|--------------|------------------|----------------------|
|
|
|
| GHC Compiler | `--lsp compiler` | `ghcide` |
|
|
|
| Hadrian | `--lsp .` | `ghcide` | |
|
|
\ No newline at end of file |
|
|
| Hadrian | `--lsp .` | `ghcide` |
|
|
|
|
|
|
![vscode_ghcide_config_compiler](uploads/444828858073add12000ae9f524eb041/vscode_ghcide_config_compiler.png) |
|
|
\ No newline at end of file |