diff options
author | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-08-02 23:44:12 +0100 |
commit | 217284360d35711b751859ed27a7a3c3da300e85 (patch) | |
tree | 4b26a84b397e3ac15a8b13a572b1f9a50312dbab /ale_linters/dart | |
parent | 9ef266d050d698c3ed3be3456ce6a5da5755d5ef (diff) | |
download | ale-217284360d35711b751859ed27a7a3c3da300e85.zip |
Simplify the code for most linters and tests with closures
Diffstat (limited to 'ale_linters/dart')
-rw-r--r-- | ale_linters/dart/dartanalyzer.vim | 9 | ||||
-rw-r--r-- | ale_linters/dart/language_server.vim | 6 |
2 files changed, 3 insertions, 12 deletions
diff --git a/ale_linters/dart/dartanalyzer.vim b/ale_linters/dart/dartanalyzer.vim index ef33c9d4..26817df5 100644 --- a/ale_linters/dart/dartanalyzer.vim +++ b/ale_linters/dart/dartanalyzer.vim @@ -3,15 +3,10 @@ call ale#Set('dart_dartanalyzer_executable', 'dartanalyzer') -function! ale_linters#dart#dartanalyzer#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'dart_dartanalyzer_executable') -endfunction - function! ale_linters#dart#dartanalyzer#GetCommand(buffer) abort - let l:executable = ale_linters#dart#dartanalyzer#GetExecutable(a:buffer) let l:path = ale#path#FindNearestFile(a:buffer, '.packages') - return ale#Escape(l:executable) + return '%e' \ . (!empty(l:path) ? ' --packages ' . ale#Escape(l:path) : '') \ . ' %s' endfunction @@ -34,7 +29,7 @@ endfunction call ale#linter#Define('dart', { \ 'name': 'dartanalyzer', -\ 'executable_callback': 'ale_linters#dart#dartanalyzer#GetExecutable', +\ 'executable_callback': ale#VarFunc('dart_dartanalyzer_executable'), \ 'command_callback': 'ale_linters#dart#dartanalyzer#GetCommand', \ 'callback': 'ale_linters#dart#dartanalyzer#Handle', \ 'lint_file': 1, diff --git a/ale_linters/dart/language_server.vim b/ale_linters/dart/language_server.vim index 2265e37a..14b6ab93 100644 --- a/ale_linters/dart/language_server.vim +++ b/ale_linters/dart/language_server.vim @@ -3,10 +3,6 @@ call ale#Set('dart_language_server_executable', 'dart_language_server') -function! ale_linters#dart#language_server#GetExecutable(buffer) abort - return ale#Var(a:buffer, 'dart_language_server_executable') -endfunction - function! ale_linters#dart#language_server#GetProjectRoot(buffer) abort " Note: pub only looks for pubspec.yaml, there's no point in adding " support for pubspec.yml @@ -18,7 +14,7 @@ endfunction call ale#linter#Define('dart', { \ 'name': 'language_server', \ 'lsp': 'stdio', -\ 'executable_callback': 'ale_linters#dart#language_server#GetExecutable', +\ 'executable_callback': ale#VarFunc('dart_language_server_executable'), \ 'command_callback': 'ale_linters#dart#language_server#GetExecutable', \ 'project_root_callback': 'ale_linters#dart#language_server#GetProjectRoot', \}) |