summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorYe Jingchen <ye.jingchen@gmail.com>2018-09-28 03:26:57 +0800
committerYe Jingchen <ye.jingchen@gmail.com>2018-09-28 03:26:57 +0800
commit8891b7c349328120e5ec3f8022399f884a67e088 (patch)
treebf8e5144032fc0465fbb8db0ccf10ed78e395bd0 /autoload
parent17676f6a6d5ba2ab47c717f7c47b04d8fc23299b (diff)
downloadale-8891b7c349328120e5ec3f8022399f884a67e088.zip
Move ccls functions to autoload/ale/handler
Tests are kept as-is.
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/handlers/ccls.vim17
1 files changed, 17 insertions, 0 deletions
diff --git a/autoload/ale/handlers/ccls.vim b/autoload/ale/handlers/ccls.vim
new file mode 100644
index 00000000..29dd6aed
--- /dev/null
+++ b/autoload/ale/handlers/ccls.vim
@@ -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