summaryrefslogtreecommitdiff
path: root/ale_linters/objc/ccls.vim
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 /ale_linters/objc/ccls.vim
parent17676f6a6d5ba2ab47c717f7c47b04d8fc23299b (diff)
downloadale-8891b7c349328120e5ec3f8022399f884a67e088.zip
Move ccls functions to autoload/ale/handler
Tests are kept as-is.
Diffstat (limited to 'ale_linters/objc/ccls.vim')
-rw-r--r--ale_linters/objc/ccls.vim22
1 files changed, 2 insertions, 20 deletions
diff --git a/ale_linters/objc/ccls.vim b/ale_linters/objc/ccls.vim
index e6736df7..0aa6a5e5 100644
--- a/ale_linters/objc/ccls.vim
+++ b/ale_linters/objc/ccls.vim
@@ -4,29 +4,11 @@
call ale#Set('objc_ccls_executable', 'ccls')
call ale#Set('objc_ccls_init_options', {})
-function! ale_linters#objc#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
-
-function! ale_linters#objc#ccls#GetInitializationOptions(buffer) abort
- return ale#Var(a:buffer, 'objc_ccls_init_options')
-endfunction
-
call ale#linter#Define('objc', {
\ 'name': 'ccls',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('objc_ccls_executable'),
\ 'command': '%e',
-\ 'project_root_callback': 'ale_linters#objc#ccls#GetProjectRoot',
-\ 'initialization_options_callback': 'ale_linters#objc#ccls#GetInitializationOptions',
+\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
+\ 'initialization_options_callback': ale#VarFunc('objc_ccls_init_options'),
\})