summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorBuck Evan <bukzor@google.com>2021-07-04 05:15:37 -0700
committerGitHub <noreply@github.com>2021-07-04 21:15:37 +0900
commit52563f91816f86fbc3e6d9f01ca50a8d85fdbee5 (patch)
tree15e2f6d878ff4e7f9d87faf9d4a29759e9268980 /autoload
parent45430eb07e0dbfbd957f2ce728603afb6e5b4100 (diff)
downloadale-52563f91816f86fbc3e6d9f01ca50a8d85fdbee5.zip
black fixer: --pyi option was appended without a space (#3759)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/fixers/black.vim23
1 files changed, 14 insertions, 9 deletions
diff --git a/autoload/ale/fixers/black.vim b/autoload/ale/fixers/black.vim
index 17697652..142cd983 100644
--- a/autoload/ale/fixers/black.vim
+++ b/autoload/ale/fixers/black.vim
@@ -18,20 +18,25 @@ endfunction
function! ale#fixers#black#Fix(buffer) abort
let l:executable = ale#fixers#black#GetExecutable(a:buffer)
- let l:exec_args = l:executable =~? 'pipenv$'
- \ ? ' run black'
- \ : ''
+ let l:cmd = [ale#Escape(l:executable)]
+
+ if l:executable =~? 'pipenv$'
+ call extend(l:cmd, ['run', 'black'])
+ endif
+
let l:options = ale#Var(a:buffer, 'python_black_options')
+ if !empty(l:options)
+ call add(l:cmd, l:options)
+ endif
+
if expand('#' . a:buffer . ':e') is? 'pyi'
- let l:options .= '--pyi'
+ call add(l:cmd, '--pyi')
endif
- let l:result = {
- \ 'command': ale#Escape(l:executable) . l:exec_args
- \ . (!empty(l:options) ? ' ' . l:options : '')
- \ . ' -',
- \}
+ call add(l:cmd, '-')
+
+ let l:result = {'command': join(l:cmd, ' ')}
if ale#Var(a:buffer, 'python_black_change_directory')
let l:result.cwd = '%s:h'