diff options
| author | Björn Linse <bjorn.linse@gmail.com> | 2016-05-12 22:25:15 +0200 | 
|---|---|---|
| committer | Björn Linse <bjorn.linse@gmail.com> | 2016-08-20 12:55:35 +0200 | 
| commit | 2d60a15e25f487eda1ac00a9e6cdf9a6564fb416 (patch) | |
| tree | 7844b2d185b27a0303183e90792a5ef807933e88 /runtime/autoload/provider/ruby.vim | |
| parent | 215922120c43163f4e1cc00851bd1b86890d3a28 (diff) | |
| download | rneovim-2d60a15e25f487eda1ac00a9e6cdf9a6564fb416.tar.gz rneovim-2d60a15e25f487eda1ac00a9e6cdf9a6564fb416.tar.bz2 rneovim-2d60a15e25f487eda1ac00a9e6cdf9a6564fb416.zip  | |
job control: reuse common job code for rpc jobs
This makes stderr and exit callbacks work for rpc jobs
Diffstat (limited to 'runtime/autoload/provider/ruby.vim')
| -rw-r--r-- | runtime/autoload/provider/ruby.vim | 18 | 
1 files changed, 16 insertions, 2 deletions
diff --git a/runtime/autoload/provider/ruby.vim b/runtime/autoload/provider/ruby.vim index e9130b98c1..c8ede20a75 100644 --- a/runtime/autoload/provider/ruby.vim +++ b/runtime/autoload/provider/ruby.vim @@ -4,6 +4,17 @@ if exists('g:loaded_ruby_provider')  endif  let g:loaded_ruby_provider = 1 +let s:stderr = {} +let s:job_opts = {'rpc': v:true} + +function! s:job_opts.on_stderr(chan_id, data, event) +  let stderr = get(s:stderr, a:chan_id, ['']) +  let last = remove(stderr, -1) +  let a:data[0] = last.a:data[0] +  call extend(stderr, a:data) +  let s:stderr[a:chan_id] = stderr +endfunction +  function! provider#ruby#Detect() abort    return exepath('neovim-ruby-host')  endfunction @@ -13,7 +24,7 @@ function! provider#ruby#Prog()  endfunction  function! provider#ruby#Require(host) abort -  let args = [] +  let args = [provider#ruby#Prog()]    let ruby_plugins = remote#host#PluginsForHost(a:host.name)    for plugin in ruby_plugins @@ -21,13 +32,16 @@ function! provider#ruby#Require(host) abort    endfor    try -    let channel_id = rpcstart(provider#ruby#Prog(), args) +    let channel_id = jobstart(args, s:job_opts)      if rpcrequest(channel_id, 'poll') ==# 'ok'        return channel_id      endif    catch      echomsg v:throwpoint      echomsg v:exception +    for row in get(s:stderr, channel_id, []) +      echomsg row +    endfor    endtry    throw remote#host#LoadErrorForHost(a:host.orig_name, '$NVIM_RUBY_LOG_FILE')  endfunction  | 
