From a0678a5849d346788767b33c09f1b657a06e77c5 Mon Sep 17 00:00:00 2001 From: Riley Bruins Date: Sun, 9 Nov 2025 14:28:02 -0800 Subject: [PATCH] fix(lsp): ignore inline completions after leaving insert mode (#36476) **Problem:** When quickly entering and leaving insert mode, sometimes inline completion requests are returned and handled in normal mode. This causes an extmark to be set, which will not get cleared until the next time entering & leaving insert mode. **Solution:** Return early in the inline completion handler if we have left insert mode. --- runtime/lua/vim/lsp/inline_completion.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/lua/vim/lsp/inline_completion.lua b/runtime/lua/vim/lsp/inline_completion.lua index 1d31cd8b24..a5e6f4e7d3 100644 --- a/runtime/lua/vim/lsp/inline_completion.lua +++ b/runtime/lua/vim/lsp/inline_completion.lua @@ -121,7 +121,7 @@ function Completor:handler(err, result, ctx) log.error('inlinecompletion', err) return end - if not result then + if not result or not vim.startswith(api.nvim_get_mode().mode, 'i') then return end