Emacs

Fangrui Song 2018-07-28 20:15:17 -07:00
parent 91e817eed6
commit e9a133c9dc
4 changed files with 19 additions and 15 deletions

@ -55,9 +55,12 @@ To turn on ccls for all C/C++ modes:
(lsp-ccls-enable)
(user-error nil)))
(use-package ccls
(use-package ccls
:commands lsp-ccls-enable
:init (add-hook 'c-mode-common-hook #'ccls//enable))
:init
(add-hook 'c-common-hook #'ccls//enable)
(add-hook 'c++-common-hook #'ccls//enable)
)
;; Also see lsp-project-whitelist lsp-project-blacklist ccls-root-matchers
```

10
FAQ.md

@ -147,16 +147,6 @@ ccls will save a file in `cacheDirectory`:
...
```
### AST deserialisation error when precompiled headers are used
Unfortunately, libclang is very picky when it comes to precompiled headers. Even if your system compiler and the bundled libclang are the same versions there will be problems. Namely, to avoid AST deresialisation errors while using PCH, you need to create them with the same toolchain which will be used inside ccls for completions.
However, making ccls use precompiled headers doesn't make much sense. Libclang will internally create the precompiled headers, but won't store them on permanent storage, so having precompiled headers upfront only speeds up the initial parse - precompiled headers shouldn't make a difference on subsequent parses.
Going back to "create precompiled headers with the same toolchain that will be used by ccls", you can still use precompiled headers, but you will be forced to use your system's libclang, not the one bundled with cquery (even though the bundled one is what's tested).
For reference, read [Valloric/ycmd#892](https://github.com/Valloric/ycmd/issues/892) and [cquery-project/cquery#545](https://github.com/cquery-project/cquery/issues/545).
### Definitions
`textDocument/definition` can be used in many places. Some are current implementation details and may subject to change.

@ -23,14 +23,16 @@ The executable is at `release/ccls`.
Additional notes: If your `libstdc++` is too old (no C++17 header files) or have an old GCC/Clang, you may use the `-DCLANG_USE_BUNDLED_LIBC++=on` command at [[Build]].
* Arch Linux: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`. `-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller.
* Arch Linux: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`.
[aur/ccls-git](https://aur.archlinux.org/packages/ccls-git) currently does not work as it links against `extra/clang=6.0.1-1` which has a [known issue](https://github.com/MaskRay/ccls/issues/30).
* FreeBSD
+ with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX=/usr/local/llvm60`
+ with `llvm60` installed: `cmake -H. -BRelease -DSYSTEM_CLANG=on -DUSE_SHARED_LLVM=on -DCMAKE_PREFIX_PATH=/usr/local/llvm60`
+ use libc++: `cmake -H. -BRelease -DCLANG_USE_BUNDLED_LIBC++=on`
* Linux with newer libstdc++ and clang>=6: `cmake -H. -BRelease -DUSE_SHARED_LLVM=on`
* Linux with `gcc < 7` but `clang >= 5`, `cmake -H. -BRelease -DCMAKE_CXX_COMPILER=clang++`
`-DUSE_SHARED_LLVM=on` (optional) makes linked executable smaller.
### Setup your editor
Find your editor from the sidebar under the section "Editor configuration".

@ -99,6 +99,15 @@ yes '' | make config
bear make -j bzImage modules
```
### musl
```zsh
mkdir Debug; cd Debug
../configure --enable-optimize=no --enable-debug --prefix=~/.local/stow/musl
bear make -j
cd ..; ln -s Debug/compile_commands.json
```
## Misc
`compile_commands.json` should reside in the project root. Set the initialization option `compilationDatabaseDirectory` for an alternative directory containing `compile_commands.json`.