Skip to content
Chen edited this page Dec 15, 2017 · 14 revisions

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

Building

See https://github.com/jacobdufault/cquery#build-cquery

Configuration

let g:LanguageClient_serverCommands = {
\ 'cpp': ['yourCQueryDirectory/build/app', '--language-server']                                                                                                                                                                              
\ }
let g:LanguageClient_loadSettings = 1
" Use an absolute configuration path if you want system-wide settings
" let g:LanguageClient_settingsPath = '/home/yourusername/.config/nvim/settings.json'

Workspace configuration

Add in your project a file under .vim/settings.json with this content

{
        "initializationOptions": {
                "cacheDirectory": "/tmp/cquery"
        }
}

Change cacheDirectory according to your needs

If cquery failed to figure out the resource directory, replace the above content with:

{
        "initializationOptions": {
                "cacheDirectory": "/tmp/cquery",
                "resourceDirectory": "/absolute/path/to/yourCQueryDirectory/clang_resource_dir"
        }
}

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.

Clone this wiki locally