mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-17 17:55:56 +08:00
Allow strings to be used for selecting a single fix function for g:ale_fixers too
This commit is contained in:
@@ -225,7 +225,13 @@ function! ale#fix#Fix() abort
|
|||||||
let l:callback_list = []
|
let l:callback_list = []
|
||||||
|
|
||||||
for l:sub_type in split(&filetype, '\.')
|
for l:sub_type in split(&filetype, '\.')
|
||||||
call extend(l:callback_list, get(g:ale_fixers, l:sub_type, []))
|
let l:sub_type_callacks = get(g:ale_fixers, l:sub_type, [])
|
||||||
|
|
||||||
|
if type(l:sub_type_callacks) == type('')
|
||||||
|
call add(l:callback_list, l:sub_type_callacks)
|
||||||
|
else
|
||||||
|
call extend(l:callback_list, l:sub_type_callacks)
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
if empty(l:callback_list)
|
if empty(l:callback_list)
|
||||||
|
|||||||
@@ -107,3 +107,12 @@ Expect(Only the second function should be applied):
|
|||||||
$a
|
$a
|
||||||
$b
|
$b
|
||||||
$c
|
$c
|
||||||
|
|
||||||
|
Execute(ALEFix should handle strings for selecting a single function):
|
||||||
|
let g:ale_fixers.testft = 'AddCarets'
|
||||||
|
ALEFix
|
||||||
|
|
||||||
|
Expect(The first function should be used):
|
||||||
|
^a
|
||||||
|
^b
|
||||||
|
^c
|
||||||
|
|||||||
Reference in New Issue
Block a user