mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
:checkhealth : validate 'runtimepath' (#7526)
This commit is contained in:
parent
314ff440f7
commit
f5d4da0144
@ -23,11 +23,11 @@ Commands *health-commands*
|
|||||||
*:checkhealth* *:CheckHealth*
|
*:checkhealth* *:CheckHealth*
|
||||||
:checkhealth Run all healthchecks.
|
:checkhealth Run all healthchecks.
|
||||||
*E5009*
|
*E5009*
|
||||||
Nvim depends on the |$VIMRUNTIME| environment variable
|
Nvim depends on |$VIMRUNTIME| and 'runtimepath' to find
|
||||||
to find the standard "runtime files" for syntax
|
the standard "runtime files" for syntax highlighting,
|
||||||
highlighting, filetype-specific behavior, and standard
|
filetype-specific behavior, and standard plugins
|
||||||
plugins such as :checkhealth. If $VIMRUNTIME is invalid
|
(including :checkhealth). If the runtime files cannot
|
||||||
then those features will not work.
|
be found then those features will not work.
|
||||||
|
|
||||||
:checkhealth {plugins}
|
:checkhealth {plugins}
|
||||||
Run healthcheck(s) for one or more plugins. E.g. to run
|
Run healthcheck(s) for one or more plugins. E.g. to run
|
||||||
|
@ -22883,11 +22883,15 @@ void ex_checkhealth(exarg_T *eap)
|
|||||||
const char *vimruntime_env = os_getenv("VIMRUNTIME");
|
const char *vimruntime_env = os_getenv("VIMRUNTIME");
|
||||||
if (vimruntime_env == NULL) {
|
if (vimruntime_env == NULL) {
|
||||||
EMSG(_("E5009: $VIMRUNTIME is empty or unset"));
|
EMSG(_("E5009: $VIMRUNTIME is empty or unset"));
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), os_getenv("VIMRUNTIME"));
|
bool rtp_ok = NULL != strstr((char *)p_rtp, vimruntime_env);
|
||||||
return;
|
if (rtp_ok) {
|
||||||
|
EMSG2(_("E5009: Invalid $VIMRUNTIME: %s"), vimruntime_env);
|
||||||
|
} else {
|
||||||
|
EMSG(_("E5009: Invalid 'runtimepath'"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')");
|
size_t bufsize = STRLEN(eap->arg) + sizeof("call health#check('')");
|
||||||
|
@ -16,6 +16,13 @@ describe(':checkhealth', function()
|
|||||||
eq(false, status)
|
eq(false, status)
|
||||||
eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*'))
|
eq('Invalid $VIMRUNTIME: bogus', string.match(err, 'Invalid.*'))
|
||||||
end)
|
end)
|
||||||
|
it("detects invalid 'runtimepath'", function()
|
||||||
|
clear()
|
||||||
|
command('set runtimepath=bogus')
|
||||||
|
local status, err = pcall(command, 'checkhealth')
|
||||||
|
eq(false, status)
|
||||||
|
eq("Invalid 'runtimepath'", string.match(err, 'Invalid.*'))
|
||||||
|
end)
|
||||||
it("detects invalid $VIM", function()
|
it("detects invalid $VIM", function()
|
||||||
clear()
|
clear()
|
||||||
-- Do this after startup, otherwise it just breaks $VIMRUNTIME.
|
-- Do this after startup, otherwise it just breaks $VIMRUNTIME.
|
||||||
|
Loading…
Reference in New Issue
Block a user