mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
Simplify the code for most linters and tests with closures
This commit is contained in:
@@ -6,18 +6,6 @@ call ale#Set('javascript_flow_ls_use_global',
|
||||
\ get(g:, 'ale_use_global_executables', 0)
|
||||
\)
|
||||
|
||||
function! ale_linters#javascript#flow_ls#GetExecutable(buffer) abort
|
||||
return ale#node#FindExecutable(a:buffer, 'javascript_flow_ls', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\])
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow_ls#GetCommand(buffer) abort
|
||||
let l:executable = ale_linters#javascript#flow_ls#GetExecutable(a:buffer)
|
||||
|
||||
return ale#Escape(l:executable) . ' lsp --from ale-lsp'
|
||||
endfunction
|
||||
|
||||
function! ale_linters#javascript#flow_ls#FindProjectRoot(buffer) abort
|
||||
let l:flow_config = ale#path#FindNearestFile(a:buffer, '.flowconfig')
|
||||
|
||||
@@ -31,8 +19,10 @@ endfunction
|
||||
call ale#linter#Define('javascript', {
|
||||
\ 'name': 'flow-language-server',
|
||||
\ 'lsp': 'stdio',
|
||||
\ 'executable_callback': 'ale_linters#javascript#flow_ls#GetExecutable',
|
||||
\ 'command_callback': 'ale_linters#javascript#flow_ls#GetCommand',
|
||||
\ 'executable_callback': ale#node#FindExecutableFunc('javascript_flow_ls', [
|
||||
\ 'node_modules/.bin/flow',
|
||||
\ ]),
|
||||
\ 'command': '%e lsp --from ale-lsp',
|
||||
\ 'project_root_callback': 'ale_linters#javascript#flow_ls#FindProjectRoot',
|
||||
\ 'language': 'javascript',
|
||||
\})
|
||||
|
||||
Reference in New Issue
Block a user