summaryrefslogtreecommitdiff
path: root/ale_linters/cpp/ccls.vim
diff options
context:
space:
mode:
Diffstat (limited to 'ale_linters/cpp/ccls.vim')
-rw-r--r--ale_linters/cpp/ccls.vim22
1 files changed, 2 insertions, 20 deletions
diff --git a/ale_linters/cpp/ccls.vim b/ale_linters/cpp/ccls.vim
index f1604f30..501fd685 100644
--- a/ale_linters/cpp/ccls.vim
+++ b/ale_linters/cpp/ccls.vim
@@ -4,29 +4,11 @@
call ale#Set('cpp_ccls_executable', 'ccls')
call ale#Set('cpp_ccls_init_options', {})
-function! ale_linters#cpp#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#cpp#ccls#GetInitializationOptions(buffer) abort
- return ale#Var(a:buffer, 'cpp_ccls_init_options')
-endfunction
-
call ale#linter#Define('cpp', {
\ 'name': 'ccls',
\ 'lsp': 'stdio',
\ 'executable_callback': ale#VarFunc('cpp_ccls_executable'),
\ 'command': '%e',
-\ 'project_root_callback': 'ale_linters#cpp#ccls#GetProjectRoot',
-\ 'initialization_options_callback': 'ale_linters#cpp#ccls#GetInitializationOptions',
+\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot',
+\ 'initialization_options_callback': ale#VarFunc('cpp_ccls_init_options'),
\})