#2132 - Support deferred fixers

This commit is contained in:
w0rp 2019-02-26 16:56:16 +00:00
parent 70a9176de0
commit 38009b8e58
No known key found for this signature in database
GPG Key ID: 0FC1ECAA8C81CD83

View File

@ -56,6 +56,12 @@ Before:
return {'command': 'cat - <(echo d)'} return {'command': 'cat - <(echo d)'}
endfunction endfunction
function CatLineDeferred(buffer, lines) abort
return ale#command#Run(a:buffer, 'echo', {
\ -> ale#command#Run(a:buffer, 'echo', {-> {'command': 'cat - <(echo d)'}})
\})
endfunction
function ReplaceWithTempFile(buffer, lines) abort function ReplaceWithTempFile(buffer, lines) abort
return {'command': 'echo x > %t', 'read_temporary_file': 1} return {'command': 'echo x > %t', 'read_temporary_file': 1}
endfunction endfunction
@ -193,6 +199,7 @@ After:
delfunction DoNothing delfunction DoNothing
delfunction CatLine delfunction CatLine
delfunction CatLineOneArg delfunction CatLineOneArg
delfunction CatLineDeferred
delfunction ReplaceWithTempFile delfunction ReplaceWithTempFile
delfunction CatWithTempFile delfunction CatWithTempFile
delfunction RemoveLastLine delfunction RemoveLastLine
@ -807,3 +814,14 @@ Execute(ALEFix should apply autocmds):
AssertEqual g:pre_success, 1 AssertEqual g:pre_success, 1
AssertEqual g:post_success, 1 AssertEqual g:post_success, 1
Execute(ALEFix should support ale#command#Run):
let g:ale_fixers.testft = ['CatLineDeferred']
ALEFix
call ale#test#FlushJobs()
Expect(The extra line should be added):
a
b
c
d