Merge pull request #1564 from aliou/ad-alefix-fixer-cmdline-completion
Use the command line to filter ALEFix's command line completion.
This commit is contained in:
commit
29a9c9a255
2 changed files with 15 additions and 1 deletions
|
@ -332,7 +332,7 @@ endfunction
|
|||
|
||||
" Function that returns autocomplete candidates for ALEFix command
|
||||
function! ale#fix#registry#CompleteFixers(ArgLead, CmdLine, CursorPos) abort
|
||||
return ale#fix#registry#GetApplicableFixers(&filetype)
|
||||
return filter(ale#fix#registry#GetApplicableFixers(&filetype), 'v:val =~? a:ArgLead')
|
||||
endfunction
|
||||
|
||||
" Suggest functions to use from the registry.
|
||||
|
|
14
test/fix/test_ale_fix_completion_filter.vader
Normal file
14
test/fix/test_ale_fix_completion_filter.vader
Normal file
|
@ -0,0 +1,14 @@
|
|||
Before:
|
||||
call ale#fix#registry#Clear()
|
||||
call ale#test#SetFilename('test.js')
|
||||
call ale#fix#registry#Add('prettier', '', ['javascript'], 'prettier')
|
||||
call ale#fix#registry#Add('eslint', '', ['javascript'], 'eslint')
|
||||
setfiletype javascript
|
||||
|
||||
Execute(completeFixers returns all of the applicable fixers without an arglead):
|
||||
AssertEqual ['eslint', 'prettier'],
|
||||
\ ale#fix#registry#CompleteFixers('', 'ALEFix ', 7)
|
||||
|
||||
Execute(completeFixers returns all of the applicable fixers without an arglead):
|
||||
AssertEqual ['prettier'],
|
||||
\ ale#fix#registry#CompleteFixers('pre', 'ALEFix ', 10)
|
Reference in a new issue