diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-01-22 11:19:58 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-22 11:19:58 +0800 |
commit | 18fb669b9be1e7dac73dc3d97c2e3e7fd4013099 (patch) | |
tree | fd1ea024d899214cf3759a62bb0ee3ea87bbd815 /src/nvim/runtime.c | |
parent | 108452aabad80af08351d137f528985ac339b295 (diff) | |
download | rneovim-18fb669b9be1e7dac73dc3d97c2e3e7fd4013099.tar.gz rneovim-18fb669b9be1e7dac73dc3d97c2e3e7fd4013099.tar.bz2 rneovim-18fb669b9be1e7dac73dc3d97c2e3e7fd4013099.zip |
fix(completion): include lua syntaxes in :ownsyntax completion (#21941)
This just removes DIP_LUA and always executes its branches.
Also add tests for cmdline completion for other lua runtime files.
Diffstat (limited to 'src/nvim/runtime.c')
-rw-r--r-- | src/nvim/runtime.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index fd32209310..0d7afa98a7 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -1175,12 +1175,11 @@ void ex_packadd(exarg_T *eap) /// Expand color scheme, compiler or filetype names. /// Search from 'runtimepath': -/// 'runtimepath'/{dirnames}/{pat}.vim -/// When "flags" has DIP_START: search also from 'start' of 'packpath': -/// 'packpath'/pack/ * /start/ * /{dirnames}/{pat}.vim -/// When "flags" has DIP_OPT: search also from 'opt' of 'packpath': -/// 'packpath'/pack/ * /opt/ * /{dirnames}/{pat}.vim -/// When "flags" has DIP_LUA: search also performed for .lua files +/// 'runtimepath'/{dirnames}/{pat}.(vim|lua) +/// When "flags" has DIP_START: search also from "start" of 'packpath': +/// 'packpath'/pack/*/start/*/{dirnames}/{pat}.(vim|lua) +/// When "flags" has DIP_OPT: search also from "opt" of 'packpath': +/// 'packpath'/pack/*/opt/*/{dirnames}/{pat}.(vim|lua) /// "dirnames" is an array with one or more directory names. int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirnames[]) { @@ -1197,10 +1196,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "%s/%s*.vim", dirnames[i], pat); globpath(p_rtp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "%s/%s*.lua", dirnames[i], pat); - globpath(p_rtp, s, &ga, 0); - } + snprintf(s, size, "%s/%s*.lua", dirnames[i], pat); + globpath(p_rtp, s, &ga, 0); xfree(s); } @@ -1210,10 +1207,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "pack/*/start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "pack/*/start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } @@ -1222,10 +1217,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "start/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "start/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } } @@ -1236,10 +1229,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "pack/*/opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "pack/*/opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } @@ -1248,10 +1239,8 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = xmalloc(size); snprintf(s, size, "opt/*/%s/%s*.vim", dirnames[i], pat); // NOLINT globpath(p_pp, s, &ga, 0); - if (flags & DIP_LUA) { - snprintf(s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT - globpath(p_pp, s, &ga, 0); - } + snprintf(s, size, "opt/*/%s/%s*.lua", dirnames[i], pat); // NOLINT + globpath(p_pp, s, &ga, 0); xfree(s); } } @@ -1261,8 +1250,7 @@ int ExpandRTDir(char *pat, int flags, int *num_file, char ***file, char *dirname char *s = match; char *e = s + strlen(s); if (e - s > 4 && (STRNICMP(e - 4, ".vim", 4) == 0 - || ((flags & DIP_LUA) - && STRNICMP(e - 4, ".lua", 4) == 0))) { + || STRNICMP(e - 4, ".lua", 4) == 0)) { e -= 4; for (s = e; s > match; MB_PTR_BACK(match, s)) { if (vim_ispathsep(*s)) { |