X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/0ee596c5c5e11fc79598407eaf22f83d279f7e9e..5a4872f466ebd76ddd532bdf2798554421c53df4:/.vim/bundle/ale/ale_linters/c/cquery.vim diff --git a/.vim/bundle/ale/ale_linters/c/cquery.vim b/.vim/bundle/ale/ale_linters/c/cquery.vim new file mode 100644 index 00000000..ff0f34af --- /dev/null +++ b/.vim/bundle/ale/ale_linters/c/cquery.vim @@ -0,0 +1,30 @@ +" Author: Ben Falconer , jtalowell +" 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 + " Try to find cquery configuration files first. + let l:config = ale#path#FindNearestFile(a:buffer, '.cquery') + + if !empty(l:config) + return fnamemodify(l:config, ':h') + endif + + " Fall back on default project root detection. + return ale#c#FindProjectRoot(a:buffer) +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'), +\})