mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #7867 'Add completion for :checkhealth'
Add completion for :checkhealth
This commit is contained in:
commit
ecf851bc60
@ -3442,6 +3442,10 @@ const char * set_one_cmd_context(
|
||||
case CMD_profile:
|
||||
set_context_in_profile_cmd(xp, arg);
|
||||
break;
|
||||
case CMD_checkhealth:
|
||||
xp->xp_context = EXPAND_CHECKHEALTH;
|
||||
xp->xp_pattern = (char_u *)arg;
|
||||
break;
|
||||
case CMD_behave:
|
||||
xp->xp_context = EXPAND_BEHAVE;
|
||||
xp->xp_pattern = (char_u *)arg;
|
||||
@ -4871,6 +4875,7 @@ static struct {
|
||||
{ EXPAND_AUGROUP, "augroup" },
|
||||
{ EXPAND_BEHAVE, "behave" },
|
||||
{ EXPAND_BUFFERS, "buffer" },
|
||||
{ EXPAND_CHECKHEALTH, "checkhealth" },
|
||||
{ EXPAND_COLORS, "color" },
|
||||
{ EXPAND_COMMANDS, "command" },
|
||||
{ EXPAND_COMPILER, "compiler" },
|
||||
|
@ -4257,20 +4257,20 @@ addstar (
|
||||
* use with vim_regcomp(). First work out how long it will be:
|
||||
*/
|
||||
|
||||
/* For help tags the translation is done in find_help_tags().
|
||||
* For a tag pattern starting with "/" no translation is needed. */
|
||||
// For help tags the translation is done in find_help_tags().
|
||||
// For a tag pattern starting with "/" no translation is needed.
|
||||
if (context == EXPAND_HELP
|
||||
|| context == EXPAND_CHECKHEALTH
|
||||
|| context == EXPAND_COLORS
|
||||
|| context == EXPAND_COMPILER
|
||||
|| context == EXPAND_OWNSYNTAX
|
||||
|| context == EXPAND_FILETYPE
|
||||
|| context == EXPAND_PACKADD
|
||||
|| ((context == EXPAND_TAGS_LISTFILES
|
||||
|| context == EXPAND_TAGS)
|
||||
&& fname[0] == '/'))
|
||||
|| ((context == EXPAND_TAGS_LISTFILES || context == EXPAND_TAGS)
|
||||
&& fname[0] == '/')) {
|
||||
retval = vim_strnsave(fname, len);
|
||||
else {
|
||||
new_len = len + 2; /* +2 for '^' at start, NUL at end */
|
||||
} else {
|
||||
new_len = len + 2; // +2 for '^' at start, NUL at end
|
||||
for (i = 0; i < len; i++) {
|
||||
if (fname[i] == '*' || fname[i] == '~')
|
||||
new_len++; /* '*' needs to be replaced by ".*"
|
||||
@ -4667,6 +4667,10 @@ ExpandFromContext (
|
||||
char *directories[] = { "syntax", "indent", "ftplugin", NULL };
|
||||
return ExpandRTDir(pat, 0, num_file, file, directories);
|
||||
}
|
||||
if (xp->xp_context == EXPAND_CHECKHEALTH) {
|
||||
char *directories[] = { "autoload/health", NULL };
|
||||
return ExpandRTDir(pat, 0, num_file, file, directories);
|
||||
}
|
||||
if (xp->xp_context == EXPAND_USER_LIST) {
|
||||
return ExpandUserList(xp, num_file, file);
|
||||
}
|
||||
|
@ -155,6 +155,7 @@ enum {
|
||||
EXPAND_USER_ADDR_TYPE,
|
||||
EXPAND_PACKADD,
|
||||
EXPAND_MESSAGES,
|
||||
EXPAND_CHECKHEALTH,
|
||||
};
|
||||
|
||||
|
||||
|
@ -6,6 +6,7 @@ local clear = helpers.clear
|
||||
local curbuf_contents = helpers.curbuf_contents
|
||||
local command = helpers.command
|
||||
local eq = helpers.eq
|
||||
local getcompletion = helpers.funcs.getcompletion
|
||||
|
||||
describe(':checkhealth', function()
|
||||
it("detects invalid $VIMRUNTIME", function()
|
||||
@ -31,6 +32,11 @@ describe(':checkhealth', function()
|
||||
eq("ERROR: $VIM is invalid: zub",
|
||||
string.match(curbuf_contents(), "ERROR: $VIM .* zub"))
|
||||
end)
|
||||
it('completions can be listed via getcompletion()', function()
|
||||
clear()
|
||||
eq('nvim', getcompletion('nvim', 'checkhealth')[1])
|
||||
eq('provider', getcompletion('prov', 'checkhealth')[1])
|
||||
end)
|
||||
end)
|
||||
|
||||
describe('health.vim', function()
|
||||
|
Loading…
Reference in New Issue
Block a user