aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider/pythonx.vim
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2017-07-26 07:03:52 -0400
committerGitHub <noreply@github.com>2017-07-26 07:03:52 -0400
commit6e83db479ca5d03f29bf92fe49735eba5339b75e (patch)
tree0a70a249b8e31c77f21f676cddbbf4128129ceef /runtime/autoload/provider/pythonx.vim
parent55c821184d82cd8d36d7085f74f9625a362fa7a6 (diff)
parent722806a1154a004494ef911c2b77a2f35a8a4a62 (diff)
downloadrneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.tar.gz
rneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.tar.bz2
rneovim-6e83db479ca5d03f29bf92fe49735eba5339b75e.zip
Merge pull request #7065 from jamessan/collect-provider-stderr
Provide standard mechanism to collect stderr for providers
Diffstat (limited to 'runtime/autoload/provider/pythonx.vim')
-rw-r--r--runtime/autoload/provider/pythonx.vim16
1 files changed, 4 insertions, 12 deletions
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 2f64c22c71..7285ed43ea 100644
--- a/runtime/autoload/provider/pythonx.vim
+++ b/runtime/autoload/provider/pythonx.vim
@@ -5,17 +5,7 @@ endif
let s:loaded_pythonx_provider = 1
-let s:stderr = {}
-let s:job_opts = {'rpc': v:true}
-
-" TODO(bfredl): this logic is common and should be builtin
-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
+let s:job_opts = {'rpc': v:true, 'on_stderr': function('provider#stderr_collector')}
function! provider#pythonx#Require(host) abort
let ver = (a:host.orig_name ==# 'python') ? 2 : 3
@@ -38,9 +28,11 @@ function! provider#pythonx#Require(host) abort
catch
echomsg v:throwpoint
echomsg v:exception
- for row in get(s:stderr, channel_id, [])
+ for row in provider#get_stderr(channel_id)
echomsg row
endfor
+ finally
+ call provider#clear_stderr(channel_id)
endtry
throw remote#host#LoadErrorForHost(a:host.orig_name,
\ '$NVIM_PYTHON_LOG_FILE')