Move ccls functions to autoload/ale/handler

Tests are kept as-is.
This commit is contained in:
Ye Jingchen
2018-09-28 03:26:57 +08:00
parent 17676f6a6d
commit 8891b7c349
4 changed files with 23 additions and 60 deletions

View File

@@ -0,0 +1,17 @@
scriptencoding utf-8
" Author: Ye Jingchen <ye.jingchen@gmail.com>
" Description: Utilities for ccls
function! ale#handlers#ccls#GetProjectRoot(buffer) abort
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls-root')
if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, 'compile_commands.json')
endif
if empty(l:project_root)
let l:project_root = ale#path#FindNearestFile(a:buffer, '.ccls')
endif
return !empty(l:project_root) ? fnamemodify(l:project_root, ':h') : ''
endfunction