Add ALE

Martino Pilia 2019-04-26 11:41:08 +02:00 committed by Fangrui Song
parent 9dcf6c1888
commit 6987d4bb75
4 changed files with 33 additions and 2 deletions

30
ALE.md Normal file

@ -0,0 +1,30 @@
Install [ALE](https://github.com/w0rp/ale) following its README.
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):
```viml
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:
```viml
let g:ale_completion_enabled = 1
```
ALE also provides a completion source for [deoplete](https://github.com/Shougo/deoplete.nvim), which should work out-of-the-box if deoplete is installed and enabled.
ALE exposes commands to invoke LSP features (see `|ale|`):
```viml
" 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>
```

@ -7,6 +7,7 @@
+ [[lsp-mode]] (+ emacs-ccls) + [[lsp-mode]] (+ emacs-ccls)
+ [[eglot]] + [[eglot]]
- Vim/Neovim - Vim/Neovim
+ [[ALE]]
+ [[coc.nvim]] + [[coc.nvim]]
+ [[LanguageClient-neovim]] + [[LanguageClient-neovim]]
+ [[vim-lsp]] + [[vim-lsp]]

@ -16,7 +16,7 @@ let g:lsc_server_commands = {
\} \}
``` ```
If the [compilation database](https://github.com/MaskRay/ccls/wiki/compile_commands.json) is correctly set, then things should work (e.g. reference highlight of the symbol under the cursor should be visible). See `|lsc-commands|` for the list of all available commands. If the [compilation database](https://github.com/MaskRay/ccls/wiki/Project-Setup) is correctly set, then things should work (e.g. reference highlight of the symbol under the cursor should be visible). See `|lsc-commands|` for the list of all available commands.
Default mappings are provided out-of-the-box (see `|lsc-default-map|`). To set custom mappings, change the values in `|g:lsc_auto_map|`, e.g.: Default mappings are provided out-of-the-box (see `|lsc-default-map|`). To set custom mappings, change the values in `|g:lsc_auto_map|`, e.g.:

@ -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/Project-Setup) in that project.