diff options
-rw-r--r-- | src/nvim/eval.c | 10 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 7 | ||||
-rw-r--r-- | test/functional/provider/python3_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/python_spec.lua | 5 | ||||
-rw-r--r-- | test/functional/provider/ruby_spec.lua | 5 |
5 files changed, 20 insertions, 12 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 58d42b49a7..4cf8a01ddb 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -22706,6 +22706,16 @@ static void script_host_eval(char *name, typval_T *argvars, typval_T *rettv) typval_T eval_call_provider(char *provider, char *method, list_T *arguments) { + if (!eval_has_provider(provider)) { + emsgf("E319: No \"%s\" provider found. Run \":checkhealth provider\"", + provider); + return (typval_T){ + .v_type = VAR_NUMBER, + .v_lock = VAR_UNLOCKED, + .vval.v_number = (varnumber_T)0 + }; + } + char func[256]; int name_len = snprintf(func, sizeof(func), "provider#%s#Call", provider); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 484c911a8b..0ecc389699 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -4028,12 +4028,7 @@ static void script_host_execute(char *name, exarg_T *eap) tv_list_append_number(args, (int)eap->line1); tv_list_append_number(args, (int)eap->line2); - if (!eval_has_provider(name)) { - emsgf("E319: No \"%s\" provider found. Run \":checkhealth provider\"", - name); - } else { - (void)eval_call_provider(name, "execute", args); - } + (void)eval_call_provider(name, "execute", args); } } diff --git a/test/functional/provider/python3_spec.lua b/test/functional/provider/python3_spec.lua index 5e73690986..3a33109079 100644 --- a/test/functional/provider/python3_spec.lua +++ b/test/functional/provider/python3_spec.lua @@ -11,8 +11,9 @@ do clear() if missing_provider('python3') then it(':python3 reports E319 if provider is missing', function() - expect_err([[Vim%(python3%):E319: No "python3" provider found.*]], - command, 'python3 print("foo")') + local expected = [[Vim%(py3.*%):E319: No "python3" provider found.*]] + expect_err(expected, command, 'py3 print("foo")') + expect_err(expected, command, 'py3file foo') end) pending('Python 3 (or the pynvim module) is broken/missing', function() end) return diff --git a/test/functional/provider/python_spec.lua b/test/functional/provider/python_spec.lua index 15df76d2f6..869cfd1721 100644 --- a/test/functional/provider/python_spec.lua +++ b/test/functional/provider/python_spec.lua @@ -19,8 +19,9 @@ do clear() if missing_provider('python') then it(':python reports E319 if provider is missing', function() - expect_err([[Vim%(python%):E319: No "python" provider found.*]], - command, 'python print("foo")') + local expected = [[Vim%(py.*%):E319: No "python" provider found.*]] + expect_err(expected, command, 'py print("foo")') + expect_err(expected, command, 'pyfile foo') end) pending('Python 2 (or the pynvim module) is broken/missing', function() end) return diff --git a/test/functional/provider/ruby_spec.lua b/test/functional/provider/ruby_spec.lua index 40cfe80b50..62ac91a929 100644 --- a/test/functional/provider/ruby_spec.lua +++ b/test/functional/provider/ruby_spec.lua @@ -19,8 +19,9 @@ do clear() if missing_provider('ruby') then it(':ruby reports E319 if provider is missing', function() - expect_err([[Vim%(ruby%):E319: No "ruby" provider found.*]], - command, 'ruby puts "foo"') + local expected = [[Vim%(ruby.*%):E319: No "ruby" provider found.*]] + expect_err(expected, command, 'ruby puts "foo"') + expect_err(expected, command, 'rubyfile foo') end) pending("Missing neovim RubyGem.", function() end) return |