]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/vim-lsp-ale/test/unit/runtime/autoload/lsp/callbag.vim

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:

Do not set EDITOR/VISUAL for shell
[etc/vim.git] / .vim / bundle / vim-lsp-ale / test / unit / runtime / autoload / lsp / callbag.vim
1 function! lsp#callbag#pipe(source, filter, sink) abort
2     let s:Filter = a:filter
3     let s:Next = a:sink.next
4     return {-> extend(s:, {'disposed': v:true})}
5 endfunction
6
7 function! lsp#callbag#filter(pred) abort
8     return a:pred
9 endfunction
10
11 function! lsp#callbag#subscribe(sink) abort
12     return a:sink
13 endfunction
14
15 " Functions for tests
16
17 function! lsp#callbag#piped() abort
18     return s:Filter isnot v:null && s:Next isnot v:null
19 endfunction
20
21 function! lsp#callbag#disposed() abort
22     return s:disposed
23 endfunction
24
25 function! lsp#callbag#reset() abort
26     let s:Filter = v:null
27     let s:Next = v:null
28     let s:disposed = v:false
29 endfunction
30
31 function! lsp#callbag#mock_receive(res) abort
32     if s:Filter(a:res)
33         call s:Next(a:res)
34     endif
35 endfunction