mirror of
1
0
Fork 0
ultimate-vim/sources_non_forked/ale/autoload/ale/handlers/ccls.vim

27 lines
875 B
VimL
Raw Normal View History

2018-09-30 16:58:57 -04:00
scriptencoding utf-8
" Author: Ye Jingchen <ye.jingchen@gmail.com>
" Description: Utilities for ccls
function! ale#handlers#ccls#GetProjectRoot(buffer) abort
2019-08-22 11:36:17 -04:00
" Try to find ccls configuration files first.
let l:config = ale#path#FindNearestFile(a:buffer, '.ccls-root')
2018-09-30 16:58:57 -04:00
2019-08-22 11:36:17 -04:00
if empty(l:config)
let l:config = ale#path#FindNearestFile(a:buffer, '.ccls')
2018-09-30 16:58:57 -04:00
endif
2019-08-22 11:36:17 -04:00
if !empty(l:config)
return fnamemodify(l:config, ':h')
2018-09-30 16:58:57 -04:00
endif
2019-08-22 11:36:17 -04:00
" Fall back on default project root detection.
return ale#c#FindProjectRoot(a:buffer)
2018-09-30 16:58:57 -04:00
endfunction
2020-12-04 16:15:32 -05:00
function! ale#handlers#ccls#GetInitOpts(buffer, init_options_var) abort
let l:build_dir = ale#c#GetBuildDirectory(a:buffer)
let l:init_options = empty(l:build_dir) ? {} : {'compilationDatabaseDirectory': l:build_dir}
return extend(l:init_options, ale#Var(a:buffer, a:init_options_var))
endfunction