From 866e587b88715e3c10a706687f52a54516721662 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 4 May 2015 22:14:54 +0200 Subject: provider/python: define Prog and Error functions always `provider#pythonX#Error` and `provider#pythonX#Prog` are currently meant for debugging only (the error message is not being used), and should therefore be defined always, especially in case of errors. Ref: https://github.com/neovim/neovim/pull/2549#issuecomment-98607580 --- runtime/autoload/provider/python3.vim | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'runtime/autoload/provider/python3.vim') diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim index 1a52ade0ef..392892b43a 100644 --- a/runtime/autoload/provider/python3.vim +++ b/runtime/autoload/provider/python3.vim @@ -10,10 +10,6 @@ endif let g:loaded_python3_provider = 1 let [s:prog, s:err] = provider#pythonx#Detect(3) -if s:prog == '' - " Detection failed - finish -endif function! provider#python3#Prog() return s:prog @@ -23,6 +19,11 @@ function! provider#python3#Error() return s:err endfunction +if s:prog == '' + " Detection failed + finish +endif + let s:plugin_path = expand(':p:h').'/script_host.py' " The Python3 provider plugin will run in a separate instance of the Python3 -- cgit From 2111f28fc5b716bafd7524567398c4ce020e1cc8 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Tue, 5 May 2015 11:22:53 +0200 Subject: provider/python: Call: fix usage of 'finish' in function Do not call it again in case of an exception in `remote#host#Require` (ref: https://github.com/neovim/neovim/pull/2549#issuecomment-102674350). --- runtime/autoload/provider/python3.vim | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'runtime/autoload/provider/python3.vim') diff --git a/runtime/autoload/provider/python3.vim b/runtime/autoload/provider/python3.vim index 392892b43a..f469bf55aa 100644 --- a/runtime/autoload/provider/python3.vim +++ b/runtime/autoload/provider/python3.vim @@ -32,6 +32,9 @@ call remote#host#RegisterClone('legacy-python3-provider', 'python3') call remote#host#RegisterPlugin('legacy-python3-provider', s:plugin_path, []) function! provider#python3#Call(method, args) + if s:err != '' + return + endif if !exists('s:host') let s:rpcrequest = function('rpcrequest') @@ -39,10 +42,12 @@ function! provider#python3#Call(method, args) try let s:host = remote#host#Require('legacy-python3-provider') catch + let s:err = v:exception + echohl WarningMsg echomsg v:exception + echohl None finish endtry endif - return call(s:rpcrequest, insert(insert(a:args, 'python_'.a:method), s:host)) endfunction -- cgit