diff --git a/nvim/lua/darcula/lsp/signature.lua b/nvim/lua/darcula/lsp/signature.lua index 011a798..56715de 100644 --- a/nvim/lua/darcula/lsp/signature.lua +++ b/nvim/lua/darcula/lsp/signature.lua @@ -55,6 +55,21 @@ local function close_float(bufnr) end end +-- True if a signature-help float is already open. We skip re-triggering while +-- one is shown: vim.lsp.buf.signature_help() closes and reopens the float on +-- every call, so re-triggering per keystroke caused visible blinking. We test +-- for the presence of the focus_id window var (any truthy owner) rather than a +-- specific bufnr match, matching how the float is actually tagged. +local function signature_float_open() + for _, win in ipairs(vim.api.nvim_list_wins()) do + local ok, owner = pcall(vim.api.nvim_win_get_var, win, focus_id) + if ok and owner then + return true + end + end + return false +end + function M.close(bufnr) bufnr = normalize_bufnr(bufnr) cancel_timer(bufnr) @@ -78,6 +93,12 @@ function M.update(bufnr) return end + -- If a signature float is already visible, leave it in place instead of + -- closing and reopening (the source of the blinking). + if signature_float_open() then + return + end + vim.lsp.buf.signature_help( { anchor_bias = "above", @@ -108,7 +129,9 @@ function M.setup(opts) local group = vim.api.nvim_create_augroup("DarculaLspSignature", {clear = true}) vim.api.nvim_create_autocmd( - {"TextChangedI", "TextChangedP", "CursorHoldI"}, + -- NOTE: TextChangedP intentionally excluded; it re-fires on every + -- completion-popup update and drove the signature float to blink. + {"TextChangedI", "CursorHoldI"}, { callback = M.schedule, group = group