More about clang.pathMappings

Fangrui Song 2019-03-23 08:34:42 -07:00
parent 46bfd9470c
commit f007debed4
2 changed files with 14 additions and 9 deletions

@ -101,26 +101,28 @@ Example: `{"clang": {"excludeArgs": ["-frounding-math"]}}`
Default: _empty_
A list of `<src>:<dest>` path conversions used to remap the paths of files in
A list of `src>dest` path conversions used to remap the paths of files in
the project. This can be used to move a project to a new location without
re-indexing.
If cache files were built with project root `/tmp/container/proj`, and you
If cache files were built with project root `/tmp/remote/proj`, and you
want to reuse them with a different project root `/tmp/host/proj` then copy the
cache:
```sh
rsync -a /tmp/ccls/@tmp@container@proj/ /tmp/ccls/@tmp@host@proj/ # files under project root
rsync -a /tmp/ccls/@@tmp@container@proj/ /tmp/ccls/@@tmp@host@proj/ # files outside of project root
rsync -a /tmp/ccls/@tmp@remote@proj/ /tmp/ccls/@tmp@host@proj/ # files under project root
rsync -a /tmp/ccls/@@tmp@remote@proj/ /tmp/ccls/@@tmp@host@proj/ # files outside of project root
```
Then use the initialization option `{"clang": {"pathMappings":
["/container/:/host/"]}`
Then use the initialization option
```javascript
{"clang": {"pathMappings": ["/remote/>/host/"]}
```
When `ccls` indexes `/tmp/host/proj/a.cc`, the cache file
`/tmp/ccls/@tmp@host@proj/a.cc.blob` will be reused. When `a.cc` is saved
When ccls indexes `/tmp/host/proj/a.cc`, the cache file
`/tmp/ccls/@tmp@remote@proj/a.cc.blob` will be reused. When `a.cc` is saved
(re-indexed), the newly generated `a.cc.blob` will not contain
`/tmp/container` paths any more.
`/tmp/remote` paths any more.
#### `cache.retainInMemory`

3
FAQ.md

@ -49,6 +49,9 @@ indexing.
files as you open them, by setting `index.initialBlacklist` to `["."]` (a
regular expression that will match every file).
* You can copy `.ccls-cache` built from a more powerful machine.
See [`clang.pathMappings`](Customization#clangpathMappings).
Note that when you edit a header file, `ccls` will automatically open the
associated (by name) source file if one exists, and index it as well to locate
definitions of symbols declared in the header file. For example, if you edit