commit a0678a5849d346788767b33c09f1b657a06e77c5
parent 5d3df1c41afec9e0dd4609ae3dfbccbf3ccd3241
Author: Riley Bruins <ribru17@hotmail.com>
Date: Sun, 9 Nov 2025 14:28:02 -0800
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.
Diffstat:
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
@@ -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