mirror of
				https://github.com/MaskRay/ccls.git
				synced 2025-11-04 06:15:20 +00:00 
			
		
		
		
	Add ALE
							parent
							
								
									9dcf6c1888
								
							
						
					
					
						commit
						6987d4bb75
					
				
							
								
								
									
										30
									
								
								ALE.md
									
									
									
									
									
										Normal file
									
								
							
							
								
								
								
								
									
									
								
								
								
							
						
						
									
										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)
 | 
			
		||||
    + [[eglot]]
 | 
			
		||||
  - Vim/Neovim
 | 
			
		||||
    + [[ALE]]
 | 
			
		||||
    + [[coc.nvim]]
 | 
			
		||||
    + [[LanguageClient-neovim]]
 | 
			
		||||
    + [[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.:
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -28,4 +28,4 @@ nn <silent> <M-a> :LspWorkspaceSymbol<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.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user