mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 02:21:57 +00:00
Added section on how to do customization with coc.nvim.
parent
12967e01ff
commit
91e9433fa3
51
coc.nvim.md
51
coc.nvim.md
@ -101,3 +101,54 @@ nn <silent><buffer> <C-k> :call CocLocations('ccls','$ccls/navigate',{'direction
|
|||||||
nn <silent><buffer> <C-j> :call CocLocations('ccls','$ccls/navigate',{'direction':'R'})<cr>
|
nn <silent><buffer> <C-j> :call CocLocations('ccls','$ccls/navigate',{'direction':'R'})<cr>
|
||||||
nn <silent><buffer> <C-h> :call CocLocations('ccls','$ccls/navigate',{'direction':'U'})<cr>
|
nn <silent><buffer> <C-h> :call CocLocations('ccls','$ccls/navigate',{'direction':'U'})<cr>
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Customization with coc.nvim
|
||||||
|
|
||||||
|
Options listed in [Customization](https://github.com/MaskRay/ccls/wiki/Customization) can be passed to CCLS via `initializationOptions` in the Coc configuration file. For example, if to direct ccls to look for `compile_commands.json` in the project `build` directory, you could add an entry for `compilationDatabaseDirectory`, and update `rootPatterns` accordingly.
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"languageserver": {
|
||||||
|
"ccls": {
|
||||||
|
"command": "ccls",
|
||||||
|
"filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
|
||||||
|
"rootPatterns": [".ccls-root", "build/compile_commands.json"],
|
||||||
|
"initializationOptions": {
|
||||||
|
"cache": {
|
||||||
|
"directory": ".ccls-cache"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"snippetSupport": true
|
||||||
|
},
|
||||||
|
"compilationDatabaseDirectory": "build"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Options like `clang.extraArgs` may be similarly be added using the same syntax as `client.snippetSupport` in the example above. For example, we can support C++20 by default by passing `-std=c++20` as an extra argument to clang:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"languageserver": {
|
||||||
|
"ccls": {
|
||||||
|
"command": "ccls",
|
||||||
|
"filetypes": ["c", "cpp", "cuda", "objc", "objcpp"],
|
||||||
|
"rootPatterns": [".ccls-root", "build/compile_commands.json"],
|
||||||
|
"initializationOptions": {
|
||||||
|
"cache": {
|
||||||
|
"directory": ".ccls-cache"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"snippetSupport": true
|
||||||
|
},
|
||||||
|
"compilationDatabaseDirectory": "build",
|
||||||
|
"clang": {
|
||||||
|
"extraArgs": [ "-std=c++20" ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
Loading…
Reference in New Issue
Block a user