From 00a13dc9cf8e586b3b89c75b3fafca7fc5f7aec3 Mon Sep 17 00:00:00 2001 From: Fangrui Song Date: Mon, 25 Feb 2019 14:38:00 +0000 Subject: [PATCH] Rename cacheDirectory to cache.directory --- Customization.md | 18 +++++++++++++----- LanguageClient-neovim.md | 8 +++++--- Visual-Studio-Code.md | 6 +++--- coc.nvim.md | 4 +++- vim-lsp.md | 6 +++--- 5 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Customization.md b/Customization.md index 5cda7f5..3f44e67 100644 --- a/Customization.md +++ b/Customization.md @@ -39,15 +39,21 @@ Each language client may have its own way to specify initialization options. Also, initialization options can be specified on the `ccls` command line using the [`--init` option](#--initjson). -#### `cacheDirectory` +#### `cache.directory` Default: `".ccls-cache"` +**This option was named `cacheDirectory` in the 0.20181225.8 release and before.** + If your project is `/a/b`, cache directories will be created at `/a/b/.ccls-cache/@a@b/` (files under the project root) `/a/b/.ccls-cache/@@a@b/` (files outside the project root, e.g. `/usr/include/stdio.h`). +If the path name is longer than the system limit, set `cache.hierarchicalPath` to true. +The cache files will be stored in a hierarchical manner: `/a/b/.ccls-cache/a/b/`. +Be careful if you specify an absolute path as files indexed by different projects may conflict. + This can also be an absolute path. Because the project path is encoded with `@`, cache directories of different projects will not conflict. @@ -58,12 +64,14 @@ When ccls is started, it will try loading cache files if they are not stale If the argument is an empty string, the cache will be stored only in memory. Use this if you don't want to write cache files. -Example: `{"cacheDirectory": "/work/cache/ccls"}` +Example: `{"cache": {"directory": "/tmp/ccls-cache"}}` -#### `cacheFormat` +#### `cache.format` Default: `"binary"` +**This option was named `cacheFormat` in the 0.20181225.8 release and before.** + Specify the format of the cached index files. Binary is a compact binary serialization format. @@ -240,10 +248,10 @@ incrementally. If set to `true`, a document is re-indexed for every (unsaved) change. Performance may suffer, but it is convenient for playground projects. -Generally this is best used in conjunction with empty `cacheDirectory` to +Generally this is best used in conjunction with empty `cache.directory` to avoid writing cache files to disk. -Example: `{"cacheDirectory": "", "index": {"onChange": true}}` +Example: `{"cache": {"directory": ""}, "index": {"onChange": true}}` #### `index.trackDependency` diff --git a/LanguageClient-neovim.md b/LanguageClient-neovim.md index 4aeb2ff..e75157d 100644 --- a/LanguageClient-neovim.md +++ b/LanguageClient-neovim.md @@ -15,9 +15,11 @@ nvim +PlugInstall +UpdateRemotePlugins +qa `~/.config/nvim/settings.json` (optional, by default it creates cache directory `.ccls-cache` in the project root) ```json { - "initializationOptions": { - "cacheDirectory": "/tmp/ccls" - } + "initializationOptions": { + "cache": { + "directory": "/tmp/ccls" + } + } } ``` diff --git a/Visual-Studio-Code.md b/Visual-Studio-Code.md index a7e32f1..850231a 100644 --- a/Visual-Studio-Code.md +++ b/Visual-Studio-Code.md @@ -18,20 +18,20 @@ To tell the extension where to find ccls, either add ccls to your `PATH` or set "ccls.launch.command": "/path/to/ccls/Release/ccls", ``` -### `ccls.cacheDirectory` +### `ccls.cache.directory` By default, ccls will store indexes in `.ccls-cache` of the workspace (more technically, the current working directory of ccls, which may not be what you think is the workspace root). You can set: ```javascript -"ccls.cacheDirectory": "${workspaceFolder}/.ccls-cache/" +"ccls.cache.directory": "${workspaceFolder}/.ccls-cache/" ``` or use a global cache directory: ```javascript -"ccls.cacheDirectory": "/tmp/ccls-cache/" +"ccls.cache.directory": "/tmp/ccls-cache/" ``` ### `ccls.clang.extraArgs` diff --git a/coc.nvim.md b/coc.nvim.md index d3bf2f1..a6a8a9a 100644 --- a/coc.nvim.md +++ b/coc.nvim.md @@ -10,7 +10,9 @@ Open config file with command `:CocConfig` "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"], "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"], "initializationOptions": { - "cacheDirectory": "/tmp/ccls" + "cache": { + "directory": ".ccls-cache" + } } } } diff --git a/vim-lsp.md b/vim-lsp.md index 8c814ea..873d534 100644 --- a/vim-lsp.md +++ b/vim-lsp.md @@ -9,13 +9,13 @@ if executable('ccls') \ 'name': 'ccls', \ 'cmd': {server_info->['ccls']}, \ 'root_uri': {server_info->lsp#utils#path_to_uri(lsp#utils#find_nearest_parent_file_directory(lsp#utils#get_buffer_path(), 'compile_commands.json'))}, - \ 'initialization_options': { 'cacheDirectory': '/tmp/ccls/cache' }, + \ 'initialization_options': {'cache': {'directory': '/tmp/ccls/cache' }}, \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'], \ }) endif ``` -Note you may want to customize `cacheDirectory` and `whitelist` of C/C++/... file suffixes to your taste. +Note you may want to `whitelist` of C/C++/... file suffixes to your taste. Next, set up key bindings by adding the following to your `~/.vimrc` or `~/.vim/vimrc`: @@ -28,4 +28,4 @@ nn :LspWorkspaceSymbol nn :LspDocumentSymbol ``` -Now it's good to go! Navigate to a C/C++/... project and test. Make sure you have [compilation database](https://github.com/MaskRay/ccls/wiki/compile_commands.json) in that project. \ No newline at end of file +Now it's good to go! Navigate to a C/C++/... project and test. Make sure you have [compilation database](https://github.com/MaskRay/ccls/wiki/compile_commands.json) in that project.