aboutsummaryrefslogtreecommitdiff
path: root/runtime/autoload/provider/pythonx.vim
diff options
context:
space:
mode:
authorZyX <kp-pav@yandex.ru>2017-12-03 16:49:30 +0300
committerZyX <kp-pav@yandex.ru>2017-12-03 16:49:30 +0300
commitc49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57 (patch)
treeb7e59c416d1435725c65f8952b6e55c70544d97e /runtime/autoload/provider/pythonx.vim
parent62108c3b0be46936c83f6d4c98b44ceb5e6f77fd (diff)
parent27a577586eace687c47e7398845178208cae524a (diff)
downloadrneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.gz
rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.tar.bz2
rneovim-c49e22d3964d6c7ae1c24e8ad01b5fec4ca40b57.zip
Merge branch 'master' into s-dash-stdin
Diffstat (limited to 'runtime/autoload/provider/pythonx.vim')
-rw-r--r--runtime/autoload/provider/pythonx.vim21
1 files changed, 6 insertions, 15 deletions
diff --git a/runtime/autoload/provider/pythonx.vim b/runtime/autoload/provider/pythonx.vim
index 08a0f39b01..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')
@@ -112,15 +104,14 @@ function! s:check_interpreter(prog, major_ver) abort
endif
if v:shell_error == 2
- return [0, prog_path . ' does not have the neovim module installed. '
- \ . 'See ":help provider-python".']
+ return [0, prog_path.' does not have the "neovim" module. :help provider-python']
elseif v:shell_error == 127
" This can happen with pyenv's shims.
return [0, prog_path . ' does not exist: ' . prog_ver]
elseif v:shell_error
return [0, 'Checking ' . prog_path . ' caused an unknown error. '
\ . '(' . v:shell_error . ', output: ' . prog_ver . ')'
- \ . ' Please report this at github.com/neovim/neovim.']
+ \ . ' Report this at https://github.com/neovim/neovim']
endif
return [1, '']