2018-07-22 17:30:57 +00:00
|
|
|
" Author: Andrey Melentyev <andrey.melentyev@protonmail.com>
|
|
|
|
" Description: Clangd language server
|
|
|
|
|
|
|
|
call ale#Set('c_clangd_executable', 'clangd')
|
|
|
|
call ale#Set('c_clangd_options', '')
|
2019-10-09 17:40:04 +00:00
|
|
|
call ale#Set('c_build_dir', '')
|
2018-07-22 17:30:57 +00:00
|
|
|
|
|
|
|
function! ale_linters#c#clangd#GetCommand(buffer) abort
|
2019-10-09 17:30:10 +00:00
|
|
|
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
|
|
|
|
|
2019-11-07 15:41:58 +00:00
|
|
|
return '%e'
|
2019-10-09 17:30:10 +00:00
|
|
|
\ . ale#Pad(ale#Var(a:buffer, 'c_clangd_options'))
|
|
|
|
\ . (!empty(l:build_dir) ? ' -compile-commands-dir=' . ale#Escape(l:build_dir) : '')
|
2018-07-22 17:30:57 +00:00
|
|
|
endfunction
|
|
|
|
|
|
|
|
call ale#linter#Define('c', {
|
|
|
|
\ 'name': 'clangd',
|
|
|
|
\ 'lsp': 'stdio',
|
2019-02-22 18:05:04 +00:00
|
|
|
\ 'executable': {b -> ale#Var(b, 'c_clangd_executable')},
|
|
|
|
\ 'command': function('ale_linters#c#clangd#GetCommand'),
|
2019-05-20 18:57:08 +00:00
|
|
|
\ 'project_root': function('ale#c#FindProjectRoot'),
|
2018-07-22 17:30:57 +00:00
|
|
|
\})
|