Rename cacheDirectory to cache.directory

Fangrui Song 2019-02-25 14:38:00 +00:00
parent f7950316e4
commit 00a13dc9cf
5 changed files with 27 additions and 15 deletions

@ -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 Also, initialization options can be specified on the `ccls` command line using
the [`--init` option](#--initjson). the [`--init` option](#--initjson).
#### `cacheDirectory` #### `cache.directory`
Default: `".ccls-cache"` 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 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 under the project root)
`/a/b/.ccls-cache/@@a@b/` (files outside the project root, `/a/b/.ccls-cache/@@a@b/` (files outside the project root,
e.g. `/usr/include/stdio.h`). 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 This can also be an absolute path. Because the project path is encoded with
`@`, cache directories of different projects will not conflict. `@`, 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. 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. 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"` 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 Specify the format of the cached index files. Binary is a compact binary
serialization format. serialization format.
@ -240,10 +248,10 @@ incrementally.
If set to `true`, a document is re-indexed for every (unsaved) change. If set to `true`, a document is re-indexed for every (unsaved) change.
Performance may suffer, but it is convenient for playground projects. 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. avoid writing cache files to disk.
Example: `{"cacheDirectory": "", "index": {"onChange": true}}` Example: `{"cache": {"directory": ""}, "index": {"onChange": true}}`
#### `index.trackDependency` #### `index.trackDependency`

@ -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) `~/.config/nvim/settings.json` (optional, by default it creates cache directory `.ccls-cache` in the project root)
```json ```json
{ {
"initializationOptions": { "initializationOptions": {
"cacheDirectory": "/tmp/ccls" "cache": {
} "directory": "/tmp/ccls"
}
}
} }
``` ```

@ -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.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). 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: You can set:
```javascript ```javascript
"ccls.cacheDirectory": "${workspaceFolder}/.ccls-cache/" "ccls.cache.directory": "${workspaceFolder}/.ccls-cache/"
``` ```
or use a global cache directory: or use a global cache directory:
```javascript ```javascript
"ccls.cacheDirectory": "/tmp/ccls-cache/" "ccls.cache.directory": "/tmp/ccls-cache/"
``` ```
### `ccls.clang.extraArgs` ### `ccls.clang.extraArgs`

@ -10,7 +10,9 @@ Open config file with command `:CocConfig`
"filetypes": ["c", "cpp", "cuda", "objc", "objcpp"], "filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
"rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"], "rootPatterns": [".ccls", "compile_commands.json", ".vim/", ".git/", ".hg/"],
"initializationOptions": { "initializationOptions": {
"cacheDirectory": "/tmp/ccls" "cache": {
"directory": ".ccls-cache"
}
} }
} }
} }

@ -9,13 +9,13 @@ if executable('ccls')
\ 'name': 'ccls', \ 'name': 'ccls',
\ 'cmd': {server_info->['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'))}, \ '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'], \ 'whitelist': ['c', 'cpp', 'objc', 'objcpp', 'cc'],
\ }) \ })
endif 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`: Next, set up key bindings by adding the following to your `~/.vimrc` or `~/.vim/vimrc`:
@ -28,4 +28,4 @@ nn <silent> <M-a> :LspWorkspaceSymbol<cr>
nn <silent> <M-l> :LspDocumentSymbol<cr> nn <silent> <M-l> :LspDocumentSymbol<cr>
``` ```
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. 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.