mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
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.
This commit is contained in:
parent
d56ba71af1
commit
5f527f24f0
@ -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
|
||||
|
@ -239,13 +239,18 @@ describe('vim.lsp.completion: item conversion', function()
|
||||
},
|
||||
},
|
||||
}
|
||||
local expected = {
|
||||
assert_completion_matches('<mo', items, {
|
||||
{
|
||||
abbr = 'module',
|
||||
word = '<module',
|
||||
},
|
||||
}
|
||||
assert_completion_matches('<mo', items, expected)
|
||||
})
|
||||
assert_completion_matches('', items, {
|
||||
{
|
||||
abbr = 'module',
|
||||
word = 'module',
|
||||
},
|
||||
})
|
||||
end)
|
||||
|
||||
it('fuzzy matches on label when filterText is missing', function()
|
||||
|
Loading…
Reference in New Issue
Block a user