From 5f527f24f0ea89e9071e065530cbed449507df5c Mon Sep 17 00:00:00 2001 From: Mathias Fussenegger Date: Sun, 19 Jan 2025 21:49:02 +0100 Subject: fix(lsp): don't use completion filterText if prefix is empty Follow up to https://github.com/neovim/neovim/pull/32072 If there is no prefix (e.g. at the start of word boundary or a line), it always used the `filterText` because the `match` function always returned false. --- runtime/lua/vim/lsp/completion.lua | 3 +++ 1 file changed, 3 insertions(+) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index 3c7d1f1469..9902c52c33 100644 --- a/runtime/lua/vim/lsp/completion.lua +++ b/runtime/lua/vim/lsp/completion.lua @@ -231,6 +231,9 @@ end ---@param prefix string ---@return boolean local function match_item_by_value(value, prefix) + if prefix == '' then + return true + end if vim.o.completeopt:find('fuzzy') ~= nil then return next(vim.fn.matchfuzzy({ value }, prefix)) ~= nil end -- cgit