diff options
author | w0rp <devw0rp@gmail.com> | 2018-03-03 13:27:19 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-03-03 13:27:19 +0000 |
commit | 565ffa0dc5e2fe53663f7228c05ad927c190b9e6 (patch) | |
tree | 53f894eee6a185a46746b528f969d139e4785a37 /ale_linters | |
parent | 857723e7d569c8260d95d2ce261fbf064e5bfa9f (diff) | |
download | ale-565ffa0dc5e2fe53663f7228c05ad927c190b9e6.zip |
Use the configured mdl executable, escape it in the command, and add test for it
Diffstat (limited to 'ale_linters')
-rw-r--r-- | ale_linters/markdown/mdl.vim | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/ale_linters/markdown/mdl.vim b/ale_linters/markdown/mdl.vim index 9bb20318..16b08cc5 100644 --- a/ale_linters/markdown/mdl.vim +++ b/ale_linters/markdown/mdl.vim @@ -4,6 +4,18 @@ call ale#Set('markdown_mdl_executable', 'mdl') call ale#Set('markdown_mdl_options', '') +function! ale_linters#markdown#mdl#GetExecutable(buffer) abort + return ale#Var(a:buffer, 'markdown_mdl_executable') +endfunction + +function! ale_linters#markdown#mdl#GetCommand(buffer) abort + let l:executable = ale_linters#markdown#mdl#GetExecutable(a:buffer) + let l:options = ale#Var(a:buffer, 'markdown_mdl_options') + + return ale#Escape(l:executable) + \ . (!empty(l:options) ? ' ' . l:options : '') +endfunction + function! ale_linters#markdown#mdl#Handle(buffer, lines) abort " matches: '(stdin):173: MD004 Unordered list style' let l:pattern = ':\(\d*\): \(.*\)$' @@ -20,17 +32,9 @@ function! ale_linters#markdown#mdl#Handle(buffer, lines) abort return l:output endfunction -function! ale_linters#markdown#mdl#GetCommand(buffer) abort - let l:executable = ale#Var(a:buffer, 'markdown_mdl_executable') - let l:options = ale#Var(a:buffer, 'markdown_mdl_options') - - return l:executable . (!empty(l:options) ? ' ' . l:options : '') -endfunction - - call ale#linter#Define('markdown', { \ 'name': 'mdl', -\ 'executable': 'mdl', +\ 'executable_callback': 'ale_linters#markdown#mdl#GetExecutable', \ 'command_callback': 'ale_linters#markdown#mdl#GetCommand', \ 'callback': 'ale_linters#markdown#mdl#Handle' \}) |