From 8891b7c349328120e5ec3f8022399f884a67e088 Mon Sep 17 00:00:00 2001 From: Ye Jingchen Date: Fri, 28 Sep 2018 03:26:57 +0800 Subject: Move ccls functions to autoload/ale/handler Tests are kept as-is. --- ale_linters/c/ccls.vim | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) (limited to 'ale_linters/c') diff --git a/ale_linters/c/ccls.vim b/ale_linters/c/ccls.vim index d0fa566e..5dc2339f 100644 --- a/ale_linters/c/ccls.vim +++ b/ale_linters/c/ccls.vim @@ -4,29 +4,11 @@ call ale#Set('c_ccls_executable', 'ccls') call ale#Set('c_ccls_init_options', {}) -function! ale_linters#c#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#c#ccls#GetInitializationOptions(buffer) abort - return ale#Var(a:buffer, 'c_ccls_init_options') -endfunction - call ale#linter#Define('c', { \ 'name': 'ccls', \ 'lsp': 'stdio', \ 'executable_callback': ale#VarFunc('c_ccls_executable'), \ 'command': '%e', -\ 'project_root_callback': 'ale_linters#c#ccls#GetProjectRoot', -\ 'initialization_options_callback': 'ale_linters#c#ccls#GetInitializationOptions', +\ 'project_root_callback': 'ale#handlers#ccls#GetProjectRoot', +\ 'initialization_options_callback':ale#VarFunc('c_ccls_init_options'), \}) -- cgit v1.2.3