1
0
Fork 0
mirror of synced 2024-06-02 07:21:09 -04:00
ultimate-vim/sources_non_forked/ale/ale_linters/c/cquery.vim
Amir Salihefendic f50b2142bc Updated plugins
2019-03-08 08:04:56 -03:00

29 lines
1 KiB
VimL

" Author: Ben Falconer <ben@falconers.me.uk>, jtalowell <jtalowell@protonmail.com>
" Description: A language server for C
call ale#Set('c_cquery_executable', 'cquery')
call ale#Set('c_cquery_cache_directory', expand('~/.cache/cquery'))
function! ale_linters#c#cquery#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, '.cquery')
endif
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction
function! ale_linters#c#cquery#GetInitializationOptions(buffer) abort
return {'cacheDirectory': ale#Var(a:buffer, 'c_cquery_cache_directory')}
endfunction
call ale#linter#Define('c', {
\ 'name': 'cquery',
\ 'lsp': 'stdio',
\ 'executable': {b -> ale#Var(b, 'c_cquery_executable')},
\ 'command': '%e',
\ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'),
\ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'),
\})