Maddison Hellstrom edited this page Jul 18, 2018 · 12 revisions

CQuery

CQuery is a Low-latency language server for large C++ code-bases, powered by libclang.

Configuration

let g:LanguageClient_serverCommands = {
\ 'cpp': ['yourCQueryDirectory/build/release/bin/cquery', 
\ '--log-file=/tmp/cq.log', 
\ '--init={"cacheDirectory":"/var/cquery/"}']                                                                                                                                                                              
\ }
" Use an absolute configuration path if you want system-wide settings
" let g:LanguageClient_settingsPath = '/home/yourusername/.config/nvim/settings.json'

Use with deoplete

Make sure you have installed the latest versions of deoplete (after cbcdf10-20171203) and LanguageClient-neovim (after https://github.com/autozimu/LanguageClient-neovim/pull/193 is merged).

Also install Neosnippet and configure:

imap <C-k>     <Plug>(neosnippet_expand_or_jump)
smap <C-k>     <Plug>(neosnippet_expand_or_jump)
xmap <C-k>     <Plug>(neosnippet_expand_target)

to your kepmappings. After that you may invoke <C-k> to expand and iterate over a completion item.

Troubleshooting

Completions are unexpectedly missing

If you notice that certain completion candidates are missing (e.g. you know a function exists but you aren't seeing completions for it), try disabling the completion.filterAndSort configuration option in cquery:

let g:LanguageClient_serverCommands = {
\ 'cpp': ['yourCQueryDirectory/build/release/bin/cquery', 
\ '--log-file=/tmp/cq.log', 
\ '--init={"cacheDirectory":"/var/cquery/", "completion": {"filterAndSort": false}}']                                                                                                                                                                              
\ }

Completion plugins such as Deoplete already implement filtering/sorting logic, and cquery may omit certain suggestions if the suggestion text already appears in the buffer you're editing.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.