]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/completion/test_omnifunc_completion.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / completion / test_omnifunc_completion.vader
1 Before:
2   unlet! b:ale_completion_info
3   unlet! b:ale_completion_result
4
5   let b:lsp_started = 0
6
7   runtime autoload/ale/lsp_linter.vim
8
9   function! ale#lsp_linter#StartLSP(buffer, linter, Callback) abort
10     return b:lsp_started
11   endfunction
12
13   function! SetCompletionResult(...) abort
14     let b:ale_completion_result = ['foo']
15   endfunction
16
17   function! SetCompletionResponse(...) abort
18     let b:ale_completion_result = ['foo']
19   endfunction
20
21 After:
22   unlet! b:ale_completion_info
23   unlet! b:ale_completion_result
24   unlet! b:lsp_started
25
26   delfunction SetCompletionResult
27   delfunction SetCompletionResponse
28
29   runtime autoload/ale/lsp_linter.vim
30
31   call ale#linter#Reset()
32
33 Given typescript():
34   let abc = y.
35   let foo = ab
36   let foo = (ab)
37
38 Execute(-3 should be returned when completion results cannot be requested):
39   AssertEqual -3, ale#completion#OmniFunc(1, '')
40
41 Execute(The start position should be returned when results can be requested):
42   let b:lsp_started = 1
43   call setpos('.', [bufnr(''), 3, 14, 0])
44
45   AssertEqual 11, ale#completion#OmniFunc(1, '')
46
47 Execute(The omnifunc function should return async results):
48   " Neovim struggles at running these tests.
49   if !has('nvim')
50     call timer_start(0, function('SetCompletionResult'))
51
52     AssertEqual ['foo'], ale#completion#OmniFunc(0, '')
53   endif
54
55 Execute(The omnifunc function should parse and return async responses):
56   if !has('nvim')
57     call timer_start(0, function('SetCompletionResponse'))
58
59     AssertEqual ['foo'], ale#completion#OmniFunc(0, '')
60   endif