From e48179f31e6503bfa86bf08538e64456e96446a8 Mon Sep 17 00:00:00 2001 From: glepnir Date: Thu, 22 Aug 2024 15:51:44 +0800 Subject: 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. --- runtime/lua/vim/lsp/completion.lua | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'runtime/lua/vim') diff --git a/runtime/lua/vim/lsp/completion.lua b/runtime/lua/vim/lsp/completion.lua index 6a6659fd25..022edf5fab 100644 --- 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() -- cgit