diff options
author | w0rp <devw0rp@gmail.com> | 2019-04-07 14:58:06 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2019-04-07 14:58:06 +0100 |
commit | 3bebcb5d48a7150f5a318952ee309acb67fb376d (patch) | |
tree | 97edd84badca566894fd4c4f10c2a786df2fe079 /ale_linters/d | |
parent | cdf89f8269aec31d0dfddf3a2769027d72d38155 (diff) | |
download | ale-3bebcb5d48a7150f5a318952ee309acb67fb376d.zip |
#2132 - Replace command_chain and chain_with with ale#command#Run
Diffstat (limited to 'ale_linters/d')
-rw-r--r-- | ale_linters/d/dmd.vim | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ale_linters/d/dmd.vim b/ale_linters/d/dmd.vim index c816d592..14461ae6 100644 --- a/ale_linters/d/dmd.vim +++ b/ale_linters/d/dmd.vim @@ -1,7 +1,7 @@ " Author: w0rp <devw0rp@gmail.com> " Description: "dmd for D files" -function! ale_linters#d#dmd#DUBCommand(buffer) abort +function! ale_linters#d#dmd#GetDUBCommand(buffer) abort " If we can't run dub, then skip this command. if !executable('dub') " Returning an empty string skips to the DMD command. @@ -21,7 +21,18 @@ function! ale_linters#d#dmd#DUBCommand(buffer) abort \ . ' && dub describe --import-paths' endfunction -function! ale_linters#d#dmd#DMDCommand(buffer, dub_output) abort +function! ale_linters#d#dmd#RunDUBCommand(buffer) abort + let l:command = ale_linters#d#dmd#GetDUBCommand(a:buffer) + + if empty(l:command) + " If we can't run DUB, just run DMD. + return ale_linters#d#dmd#DMDCommand(a:buffer, [], {}) + endif + + return ale#command#Run(a:buffer, l:command, function('ale_linters#d#dmd#DMDCommand')) +endfunction + +function! ale_linters#d#dmd#DMDCommand(buffer, dub_output, meta) abort let l:import_list = [] " Build a list of import paths generated from DUB, if available. @@ -57,9 +68,7 @@ endfunction call ale#linter#Define('d', { \ 'name': 'dmd', \ 'executable': 'dmd', -\ 'command_chain': [ -\ {'callback': 'ale_linters#d#dmd#DUBCommand', 'output_stream': 'stdout'}, -\ {'callback': 'ale_linters#d#dmd#DMDCommand', 'output_stream': 'stderr'}, -\ ], +\ 'command': function('ale_linters#d#dmd#RunDUBCommand'), \ 'callback': 'ale_linters#d#dmd#Handle', +\ 'output_stream': 'stderr', \}) |