provider: improve error message if provider is missing (#9487)

Move `has_eval_provider()` check to `eval_call_provider()` to make sure that
every code path calls it first.

Previously we would, when pynvim was missing, get a nice error message for
`:python3 1`, but not for `:py3file blah`.

Fixes https://github.com/neovim/neovim/issues/9485
This commit is contained in:
Marco Hinz
2019-01-12 00:52:12 +01:00
committed by GitHub
parent 8853fca1fd
commit db3c797c6b
5 changed files with 20 additions and 12 deletions

View File

@@ -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);
}
}