From f007debed4fd1184a81744d7c4c4fe5927271c4a Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Sat, 23 Mar 2019 08:34:42 -0700 Subject: [PATCH] More about clang.pathMappings --- Customization.md | 20 +++++++++++--------- FAQ.md | 3 +++ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Customization.md b/Customization.md index 317374c..2be33b1 100644 --- a/Customization.md +++ b/Customization.md @@ -101,26 +101,28 @@ Example: `{"clang": {"excludeArgs": ["-frounding-math"]}}` Default: _empty_ -A list of `:` 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` diff --git a/FAQ.md b/FAQ.md index 19cf3ae..28d5798 100644 --- a/FAQ.md +++ b/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