update callbag

This commit is contained in:
Prabir Shrestha
2024-02-25 21:53:07 -08:00
parent 4a17c49627
commit 6b613f0daa

View File

@@ -1,4 +1,4 @@
" https://github.com/prabirshrestha/callbag.vim#e289ec6f849b041578c5483df2fe35e96c9f241e " https://github.com/prabirshrestha/callbag.vim#6951996ea16ab096b35630f9ae744793be896b9a
" :CallbagEmbed path=autoload/lsp/callbag.vim namespace=lsp#callbag " :CallbagEmbed path=autoload/lsp/callbag.vim namespace=lsp#callbag
function! s:noop(...) abort function! s:noop(...) abort
@@ -1176,39 +1176,29 @@ function! s:takeUntilCreateSource(ctxSource, o) abort
let l:ctxTakeUntilCreateSource = { let l:ctxTakeUntilCreateSource = {
\ 'ctxSource': a:ctxSource, \ 'ctxSource': a:ctxSource,
\ 'o': a:o, \ 'o': a:o,
\ 'sourceUnsubscribe': function('s:noop'),
\ 'notifierUnsubscribe': function('s:noop'),
\ } \ }
let l:observer = { let l:ctxTakeUntilCreateSource['sourceSubscription'] = lsp#callbag#subscribe({
\ 'next': function('s:takeUntilNextFn', [l:ctxTakeUntilCreateSource]), \ 'next': a:o['next'],
\ 'error': a:o['error'], \ 'error': a:o['error'],
\ 'complete': function('s:noop') \ 'complete': a:o['complete'],
\ } \ })(a:ctxSource['source'])
let l:ctxTakeUntilCreateSource['sourceUnsubscribe'] = lsp#callbag#subscribe(l:observer)(a:ctxSource['source']) let l:ctxTakeUntilCreateSource['notifierSubscription'] = lsp#callbag#subscribe({
\ 'next': function('s:takeUntilNotifierNextFn', [l:ctxTakeUntilCreateSource]),
let l:notifierObserver = {
\ 'next': function('s:takeUntilNotifierObserverNextFn', [l:ctxTakeUntilCreateSource]),
\ 'error': a:o['error'], \ 'error': a:o['error'],
\ 'complete': function('s:noop') \ 'complete': a:o['complete'],
\ } \ })(a:ctxSource['ctx']['notifier'])
let l:ctxTakeUntilCreateSource['notifierUnsubscribe'] = lsp#callbag#subscribe(l:notifierObserver)(l:ctxTakeUntilCreateSource['ctxSource']['ctx']['notifier'])
return function('s:takeUntilDisposeFn', [l:ctxTakeUntilCreateSource]) return function('s:takeUntilDisposeFn', [l:ctxTakeUntilCreateSource])
endfunction endfunction
function! s:takeUntilDisposeFn(ctxTakeUntilCreateSource) abort function! s:takeUntilDisposeFn(ctxTakeUntilCreateSource) abort
call a:ctxTakeUntilCreateSource['sourceUnsubscribe']() call a:ctxTakeUntilCreateSource['sourceSubscription']()
call a:ctxTakeUntilCreateSource['notifierUnsubscribe']() call a:ctxTakeUntilCreateSource['notifierSubscription']()
endfunction endfunction
function! s:takeUntilNextFn(ctxTakeUntilCreateSource, value) abort function! s:takeUntilNotifierNextFn(ctxTakeUntilCreateSource, value) abort
call a:ctxTakeUntilCreateSource['o']['next'](a:value)
endfunction
function! s:takeUntilNotifierObserverNextFn(ctxTakeUntilCreateSource, value) abort
call a:ctxTakeUntilCreateSource['sourceUnsubscribe']()
call a:ctxTakeUntilCreateSource['o']['complete']() call a:ctxTakeUntilCreateSource['o']['complete']()
endfunction endfunction
" }}} " }}}