Merge pull request #2189 from jeremija/jeremija/manual-autocomplete-wo-prefix

Manually trigger autocomplete even when prefix is ""
This commit is contained in:
w0rp
2019-01-08 14:27:04 +00:00
committed by GitHub
4 changed files with 46 additions and 27 deletions

View File

@@ -16,6 +16,9 @@ Execute(Prefix filtering should work for Lists of strings):
AssertEqual
\ ['FooBar', 'FongBar', 'baz', 'foo'],
\ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '.')
AssertEqual
\ ['FooBar', 'FongBar', 'baz', 'foo'],
\ ale#completion#Filter(bufnr(''), '', ['FooBar', 'FongBar', 'baz', 'foo'], '')
Execute(Prefix filtering should work for completion items):
AssertEqual
@@ -102,6 +105,9 @@ Execute(Excluding words from completion results should work with lists of String
AssertEqual
\ ['Deutsch'],
\ ale#completion#Filter(bufnr(''), '', ['describe', 'Deutsch'], '.')
AssertEqual
\ ['Deutsch'],
\ ale#completion#Filter(bufnr(''), '', ['Deutsch'], '')
Execute(Filtering shouldn't modify the original list):
let b:ale_completion_excluded_words = ['it', 'describe']

View File

@@ -1,9 +1,11 @@
Before:
function! MockAlwaysGetCompletions() abort
let g:get_completions_called = 0
let g:always_get_completions_argument = -1
function! ale#completion#AlwaysGetCompletions() abort
function! ale#completion#AlwaysGetCompletions(need_prefix) abort
let g:get_completions_called = 1
let g:always_get_completions_argument = a:need_prefix
endfunction
endfunction
@@ -11,6 +13,7 @@ Before:
After:
unlet! g:get_completions_called
unlet! g:always_get_completions_argument
delfunction MockAlwaysGetCompletions
delfunction ale#completion#AlwaysGetCompletions
@@ -20,3 +23,4 @@ Execute(ale#completion#AlwaysGetCompletions should be called when ALEComplete is
AssertEqual 0, g:get_completions_called
ALEComplete
AssertEqual 1, g:get_completions_called
AssertEqual 0, g:always_get_completions_argument