fix(lsp): avoid vim.keymap.del error when stopping a client (#29478)

(cherry picked from commit fc9b70826e)
This commit is contained in:
Matt Fellenz 2024-06-26 08:03:46 -07:00 committed by github-actions[bot]
parent 28a5923aea
commit 2d7aab623e

View File

@ -375,7 +375,7 @@ local function reset_defaults(bufnr)
end end
api.nvim_buf_call(bufnr, function() api.nvim_buf_call(bufnr, function()
local keymap = vim.fn.maparg('K', 'n', false, true) local keymap = vim.fn.maparg('K', 'n', false, true)
if keymap and keymap.callback == vim.lsp.buf.hover then if keymap and keymap.callback == vim.lsp.buf.hover and keymap.buffer == 1 then
vim.keymap.del('n', 'K', { buffer = bufnr }) vim.keymap.del('n', 'K', { buffer = bufnr })
end end
end) end)