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-05-31 14:39:36 -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-05-31 14:39:36 -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-05-31 14:39:36 -04:00
|
|
|
if !empty(l:config)
|
|
|
|
return fnamemodify(l:config, ':h')
|
2018-09-30 16:58:57 -04:00
|
|
|
endif
|
|
|
|
|
2019-05-31 14:39:36 -04:00
|
|
|
" Fall back on default project root detection.
|
|
|
|
return ale#c#FindProjectRoot(a:buffer)
|
2018-09-30 16:58:57 -04:00
|
|
|
endfunction
|