mirror of
1
0
Fork 0
ultimate-vim/sources_non_forked/ale/ale_linters/c/cquery.vim

31 lines
1.1 KiB
VimL
Raw Normal View History

2018-07-30 17:18:16 -04:00
" 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
2019-08-22 11:36:17 -04:00
" Try to find cquery configuration files first.
let l:config = ale#path#FindNearestFile(a:buffer, '.cquery')
2018-07-30 17:18:16 -04:00
2019-08-22 11:36:17 -04:00
if !empty(l:config)
return fnamemodify(l:config, ':h')
2018-08-25 12:13:42 -04:00
endif
2018-07-30 17:18:16 -04:00
2019-08-22 11:36:17 -04:00
" Fall back on default project root detection.
return ale#c#FindProjectRoot(a:buffer)
2018-07-30 17:18:16 -04:00
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',
2019-03-08 06:04:56 -05:00
\ 'executable': {b -> ale#Var(b, 'c_cquery_executable')},
2018-08-25 12:13:42 -04:00
\ 'command': '%e',
2019-03-08 06:04:56 -05:00
\ 'project_root': function('ale_linters#c#cquery#GetProjectRoot'),
\ 'initialization_options': function('ale_linters#c#cquery#GetInitializationOptions'),
2018-07-30 17:18:16 -04:00
\})