fix(lsp): when prefix is non word add all result into matches (#30044)

Problem: prefix can be a symbol like period, the fuzzy matching can't
handle it correctly.

Solution: when prefix is empty or a symbol add all lsp completion
result into matches.
This commit is contained in:
glepnir
2024-08-31 02:23:49 +08:00
committed by GitHub
parent 5f95f1249f
commit 42ed0ffad9
2 changed files with 28 additions and 7 deletions

View File

@@ -238,7 +238,7 @@ function M._lsp_to_complete_items(result, prefix, client_id)
---@type fun(item: lsp.CompletionItem):boolean
local matches
if prefix == '' then
if not prefix:find('%w') then
matches = function(_)
return true
end