diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-04-15 23:40:48 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-15 23:40:48 +0200 |
commit | c08b03076167837cff9eb66c19440d727e6dad31 (patch) | |
tree | bd99b63144c76361c5cec45715397d15bfdc935f /src/nvim/eval.c | |
parent | c8667c8756a211b8597e2e0a80200498b752915d (diff) | |
download | rneovim-c08b03076167837cff9eb66c19440d727e6dad31.tar.gz rneovim-c08b03076167837cff9eb66c19440d727e6dad31.tar.bz2 rneovim-c08b03076167837cff9eb66c19440d727e6dad31.zip |
refactor: deprecate checkhealth functions
The following functions are deprecated and will be removed in
Nvim v0.11:
- health#report_start()
- health#report_info()
- health#report_ok()
- health#report_warn()
- health#report_error()
- vim.health.report_start()
- vim.health.report_info()
- vim.health.report_ok()
- vim.health.report_warn()
- vim.health.report_error()
Users should instead use these:
- vim.health.start()
- vim.health.info()
- vim.health.ok()
- vim.health.warn()
- vim.health.error()
Diffstat (limited to 'src/nvim/eval.c')
-rw-r--r-- | src/nvim/eval.c | 42 |
1 files changed, 18 insertions, 24 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a30f9146c5..97cf0c6364 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -8597,33 +8597,27 @@ void eval_fmt_source_name_line(char *buf, size_t bufsize) /// ":checkhealth [plugins]" void ex_checkhealth(exarg_T *eap) { - bool found = !!find_func("health#check"); - if (!found - && script_autoload("health#check", sizeof("health#check") - 1, false)) { - found = !!find_func("health#check"); - } - if (!found) { - const char *vimruntime_env = os_getenv("VIMRUNTIME"); - if (vimruntime_env == NULL) { - emsg(_("E5009: $VIMRUNTIME is empty or unset")); - } else { - bool rtp_ok = NULL != strstr(p_rtp, vimruntime_env); - if (rtp_ok) { - semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env); - } else { - emsg(_("E5009: Invalid 'runtimepath'")); - } - } + Error err = ERROR_INIT; + MAXSIZE_TEMP_ARRAY(args, 1); + ADD_C(args, STRING_OBJ(cstr_as_string(eap->arg))); + NLUA_EXEC_STATIC("return vim.health._check(...)", args, &err); + if (!ERROR_SET(&err)) { return; } - size_t bufsize = strlen(eap->arg) + sizeof("call health#check('')"); - char *buf = xmalloc(bufsize); - snprintf(buf, bufsize, "call health#check('%s')", eap->arg); - - do_cmdline_cmd(buf); - - xfree(buf); + const char *vimruntime_env = os_getenv("VIMRUNTIME"); + if (vimruntime_env == NULL) { + emsg(_("E5009: $VIMRUNTIME is empty or unset")); + } else { + bool rtp_ok = NULL != strstr(p_rtp, vimruntime_env); + if (rtp_ok) { + semsg(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env); + } else { + emsg(_("E5009: Invalid 'runtimepath'")); + } + } + semsg_multiline(err.msg); + api_clear_error(&err); } void invoke_prompt_callback(void) |