aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-01-17 15:42:18 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-01-17 15:55:58 +0800
commitd5126787393075f07d4be9dc37f5d7a3cec9e177 (patch)
treebf42fe421a8d384904434d1e9c3ae3aaa065ebcb
parent441d13eae5569be2856a8d17b87f0897b85f4ad8 (diff)
downloadrneovim-d5126787393075f07d4be9dc37f5d7a3cec9e177.tar.gz
rneovim-d5126787393075f07d4be9dc37f5d7a3cec9e177.tar.bz2
rneovim-d5126787393075f07d4be9dc37f5d7a3cec9e177.zip
fix(completion): correct what modes support fuzzy completion
-rw-r--r--src/nvim/cmdexpand.c4
-rw-r--r--test/functional/editor/completion_spec.lua3
2 files changed, 6 insertions, 1 deletions
diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c
index 0d291881ba..779605c29a 100644
--- a/src/nvim/cmdexpand.c
+++ b/src/nvim/cmdexpand.c
@@ -105,13 +105,15 @@ static bool cmdline_fuzzy_completion_supported(const expand_T *const xp)
&& xp->xp_context != EXPAND_FILES_IN_PATH
&& xp->xp_context != EXPAND_FILETYPE
&& xp->xp_context != EXPAND_HELP
+ && xp->xp_context != EXPAND_LUA
&& xp->xp_context != EXPAND_OLD_SETTING
&& xp->xp_context != EXPAND_OWNSYNTAX
&& xp->xp_context != EXPAND_PACKADD
&& xp->xp_context != EXPAND_SHELLCMD
&& xp->xp_context != EXPAND_TAGS
&& xp->xp_context != EXPAND_TAGS_LISTFILES
- && xp->xp_context != EXPAND_USER_LIST;
+ && xp->xp_context != EXPAND_USER_LIST
+ && xp->xp_context != EXPAND_USER_LUA;
}
/// Returns true if fuzzy completion for cmdline completion is enabled and
diff --git a/test/functional/editor/completion_spec.lua b/test/functional/editor/completion_spec.lua
index c503d7ebfb..22857efe5b 100644
--- a/test/functional/editor/completion_spec.lua
+++ b/test/functional/editor/completion_spec.lua
@@ -935,6 +935,9 @@ describe('completion', function()
eq({'api'}, funcs.getcompletion('vim.ap', 'lua'))
eq({'tbl_filter'}, funcs.getcompletion('vim.tbl_fil', 'lua'))
eq({'vim'}, funcs.getcompletion('print(vi', 'lua'))
+ -- fuzzy completion is not supported, so the result should be the same
+ command('set wildoptions+=fuzzy')
+ eq({'vim'}, funcs.getcompletion('vi', 'lua'))
end)
end)