index.multiVersion

Fangrui Song 2018-09-03 13:01:57 -07:00
parent fd76bb9b1d
commit 00c0e9fea8

@ -1,28 +1,24 @@
You need to configure your language client plugin to send initialization options to the ccls process (the language server). `cacheDirectory` points to a directory (relative or absolute) storing indexing files so that next time ccls can load these indexing results without full indexing. You need to configure your language client plugin to send initialization options to the ccls process (the language server).
```json
{
"initializationOptions": {
"cacheDirectory": "/tmp/ccls"
}
}
```
You can also pass options through the command line option `--init`: Each language client has its own way to specify initialization options. ccls supports a command line option `--init`:
* shell: `--init='{"enableComments": 2}'` . Single quotes are used to escape words in shell. * zsh: `--init='{"index": {"comments": 2}}'`
* Emacs: `(setq ccls-extra-init-params '(:enableComments 2 :cacheFormat "msgpack"))`
## `index.threads` number of indexer threads ## `cacheDirectory`
If `index.threads` is 0, use `std::thread::hardware_concurrency()`. It points to a directory (relative or absolute) storing indexing files so that next time ccls can load these indexing results without full indexing.
## `index.comments`: indexing comments ## `index.threads`: number of indexer threads
If `index.threads` is 0, use `std::thread::hardware_concurrency()`. If you want to control peak memory usage, set it to a small integer.
## `index.comments`: index comments
- `0`, don't index comments - `0`, don't index comments
- `1`, index Doxygen comment markers - `1`, index Doxygen comment markers
- `2`, default, use `-fparse-all-comments` and recognize plain `//` `/* */` besides Doxygen comment markers - `2`, default, use `-fparse-all-comments` and recognize plain `//` `/* */` besides Doxygen comment markers
With the value larger than 0, ccls will index comments associated with functions/types/variables (macros are not handled due to `clang_Cursor_getRawCommentText`'s peculiarity). With the value larger than 0, ccls will index comments associated with functions/types/variables (macros are not handled).
This feature requires UI support as multi-line hover results poses a problem to editors: This feature requires UI support as multi-line hover results poses a problem to editors:
@ -32,6 +28,25 @@ This feature requires UI support as multi-line hover results poses a problem to
* Vim * Vim
+ LanguageClient-neovim: preview window + LanguageClient-neovim: preview window
## `index.multiVersion`: index a file in each translation unit that includes it
It is 0 by default which is sensible for common usage: it reduces memory footprint.
If both `a.cc` and `b.cc` include `a.h`, there is only one indexed version of `a.h`.
But for dependent name lookup, or references in headers that may change depending on other macros, etc,
you may want to index a file multiple times to get every possible cross reference.
Set the option to 1 but be cautious that it may increase index file sizes a lot.
You usually want to use `index.multiVersionBlacklist` to exclude system headers.
```javascript
{
"index": {
"multiVersion": 1,
"multiVersionBlacklist": ["^/usr/include"]
}
}
```
## `cacheFormat`: serialization format of cache files ## `cacheFormat`: serialization format of cache files
Two cache serialization formats are supported. Two cache serialization formats are supported.