mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(lsp): autotrigger should only trigger on client's triggerCharacters (#32266)
Problem: autotrigger option of vim.lsp.completion.enable() would trigger all clients, as long as it matched at least one client's triggerCharacters. Solution: trigger only the clients with triggerCharacters matching the character. overtriggering still happens if any client returns isIncomplete=true (this case is more involved). Co-authored-by: Mathias Fussenegger <f.mathias@zignar.net>
This commit is contained in:
@@ -518,11 +518,14 @@ local function on_insert_char_pre(handle)
|
||||
end
|
||||
|
||||
local char = api.nvim_get_vvar('char')
|
||||
if not completion_timer and handle.triggers[char] then
|
||||
local matched_clients = handle.triggers[char]
|
||||
if not completion_timer and matched_clients then
|
||||
completion_timer = assert(vim.uv.new_timer())
|
||||
completion_timer:start(25, 0, function()
|
||||
reset_timer()
|
||||
vim.schedule(M.trigger)
|
||||
vim.schedule(function()
|
||||
trigger(api.nvim_get_current_buf(), matched_clients)
|
||||
end)
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user