neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

provider.vim (641B)


      1 " Common functions for providers
      2 
      3 " Start the provider and perform a 'poll' request
      4 "
      5 " Returns a valid channel on success
      6 function! provider#Poll(argv, orig_name, log_env, ...) abort
      7  let job = {'rpc': v:true, 'stderr_buffered': v:true}
      8  if a:0
      9    let job = extend(job, a:1)
     10  endif
     11  try
     12    let channel_id = jobstart(a:argv, job)
     13    if channel_id > 0 && rpcrequest(channel_id, 'poll') ==# 'ok'
     14      return channel_id
     15    endif
     16  catch
     17    echomsg v:throwpoint
     18    echomsg v:exception
     19    for row in get(job, 'stderr', [])
     20      echomsg row
     21    endfor
     22  endtry
     23  throw remote#host#LoadErrorForHost(a:orig_name, a:log_env)
     24 endfunction