4 ALE
Alexey Vazhnov edited this page 2021-11-14 03:03:23 +03:00

Install ALE following its README.

ALE locates .ccls-root to set up the project root, see https://github.com/dense-analysis/ale/blob/master/autoload/ale/handlers/ccls.vim

ALE automatically loads all available linters and LSP clients for the filetype so, if ccls is correctly installed, it should work out-of-the-box. Moreover, ALE will automatically detect the root folder of your project.

To set init options for ccls, add to ~/.vimrc or ~/.vim/vimrc (example for cpp files, set other filetypes as needed):

let g:ale_cpp_ccls_init_options = {
\   'cache': {
\       'directory': '/tmp/ccls/cache'
\   }
\ }

Diagnostic is enabled out-of-the-box. Completion (omnifunc) can be enabled with:

let g:ale_completion_enabled = 1

ALE also provides a completion source for deoplete, which should work out-of-the-box if deoplete is installed and enabled.

ALE exposes commands to invoke LSP features (see |ale|):

" Example keybindings
nn <silent> <M-d> :ALEGoToDefinition<cr>
nn <silent> <M-r> :ALEFindReferences<cr>
nn <silent> <M-a> :ALESymbolSearch<cr>
nn <silent> <M-h> :ALEHover<cr>