diff --git a/runtime/lua/vim/lsp/inline_completion.lua b/runtime/lua/vim/lsp/inline_completion.lua index 07f46f343a..4a1de0cc73 100644 --- a/runtime/lua/vim/lsp/inline_completion.lua +++ b/runtime/lua/vim/lsp/inline_completion.lua @@ -309,6 +309,7 @@ function Completor:abort() method = ms.textDocument_inlineCompletion, type = 'pending', }) + self:reset_timer() self:hide() self.current = nil end diff --git a/test/functional/plugin/lsp/inline_completion_spec.lua b/test/functional/plugin/lsp/inline_completion_spec.lua index 4b4b4a2819..028d0cdf8a 100644 --- a/test/functional/plugin/lsp/inline_completion_spec.lua +++ b/test/functional/plugin/lsp/inline_completion_spec.lua @@ -172,6 +172,18 @@ describe('vim.lsp.inline_completion', function() feed('') screen:expect({ grid = grid_without_candidates }) end) + + it('no request when leaving insert mode immediately after typing', function() + screen:expect({ grid = grid_without_candidates }) + feed('ifoobar') + screen:expect([[ + function fibonacci() | + fooba^r | + {1:~ }|*11 + | + ]]) + screen:expect_unchanged(false, 500) + end) end) describe('get()', function()