commit e48179f31e6503bfa86bf08538e64456e96446a8
parent 3bd7492a69a0bf00b366a46dc09d5035b9f784e4
Author: glepnir <glephunter@gmail.com>
Date: Thu, 22 Aug 2024 15:51:44 +0800
fix(lsp): suppress completion request if completion is active (#30028)
Problem: the autotrigger mechanism could fire completion requests despite
completion already being active from another completion mechanism or manual
trigger
Solution: add a condition to avoid an additional request.
Diffstat:
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua
@@ -403,6 +403,10 @@ local function trigger(bufnr, clients)
reset_timer()
Context:cancel_pending()
+ if tonumber(vim.fn.pumvisible()) == 1 and Context.isIncomplete then
+ return
+ end
+
local win = api.nvim_get_current_win()
local cursor_row, cursor_col = unpack(api.nvim_win_get_cursor(win)) --- @type integer, integer
local line = api.nvim_get_current_line()