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.
This commit is contained in:
Riley Bruins
2025-11-09 14:28:02 -08:00
committed by GitHub
parent 5d3df1c41a
commit a0678a5849

View File

@@ -121,7 +121,7 @@ function Completor:handler(err, result, ctx)
log.error('inlinecompletion', err) log.error('inlinecompletion', err)
return return
end end
if not result then if not result or not vim.startswith(api.nvim_get_mode().mode, 'i') then
return return
end end