aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/eval.c
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2019-08-04 12:37:05 +0200
committerJustin M. Keyes <justinkz@gmail.com>2019-08-04 13:23:46 +0200
commit2141dc22625f73f3ce73460e581934b94f141cf9 (patch)
tree71167260e69f87566391af2b1a8924987e6fe1d7 /src/nvim/eval.c
parente952b7fc2f9838441308d1f71b98f108ae5faa8a (diff)
downloadrneovim-2141dc22625f73f3ce73460e581934b94f141cf9.tar.gz
rneovim-2141dc22625f73f3ce73460e581934b94f141cf9.tar.bz2
rneovim-2141dc22625f73f3ce73460e581934b94f141cf9.zip
provider: check #Call() if g:loaded_xx_provider=2
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r--src/nvim/eval.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index dc18532b40..d82a081c27 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -23996,8 +23996,7 @@ bool eval_has_provider(const char *name)
if (get_var_tv(buf, len, &tv, NULL, false, true) == FAIL) {
// Show a hint if Call() is defined but g:loaded_xx_provider is missing.
snprintf(buf, sizeof(buf), "provider#%s#Call", name);
- bool has_call = !!find_func((char_u *)buf);
- if (has_call && p_lpl) {
+ if (!!find_func((char_u *)buf) && p_lpl) {
emsgf("provider: %s: missing required variable g:loaded_%s_provider",
name, name);
}
@@ -24005,9 +24004,21 @@ bool eval_has_provider(const char *name)
}
}
- return (tv.v_type == VAR_NUMBER)
+ bool ok = (tv.v_type == VAR_NUMBER)
? 2 == tv.vval.v_number // Value of 2 means "loaded and working".
: false;
+
+ if (ok) {
+ // Call() must be defined if provider claims to be working.
+ snprintf(buf, sizeof(buf), "provider#%s#Call", name);
+ if (!find_func((char_u *)buf)) {
+ emsgf("provider: %s: g:loaded_%s_provider=2 but %s is not defined",
+ name, name, buf);
+ ok = false;
+ }
+ }
+
+ return ok;
}
/// Writes "<sourcing_name>:<sourcing_lnum>" to `buf[bufsize]`.