mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
fix(lsp): check whether buffer is valid when scheduled #35461
This commit is contained in:
@@ -265,7 +265,7 @@ end
|
|||||||
|
|
||||||
---@param client_id integer
|
---@param client_id integer
|
||||||
function State:on_attach(client_id)
|
function State:on_attach(client_id)
|
||||||
self.client_state = {}
|
self.client_state[client_id] = {}
|
||||||
self:refresh(vim.lsp.get_client_by_id(client_id))
|
self:refresh(vim.lsp.get_client_by_id(client_id))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -344,7 +344,9 @@ function M.foldexpr(lnum)
|
|||||||
if not vim.lsp._capability.is_enabled('folding_range', { bufnr = bufnr }) then
|
if not vim.lsp._capability.is_enabled('folding_range', { bufnr = bufnr }) then
|
||||||
-- `foldexpr` lead to a textlock, so any further operations need to be scheduled.
|
-- `foldexpr` lead to a textlock, so any further operations need to be scheduled.
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
vim.lsp._capability.enable('folding_range', true, { bufnr = bufnr })
|
if api.nvim_buf_is_valid(bufnr) then
|
||||||
|
vim.lsp._capability.enable('folding_range', true, { bufnr = bufnr })
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user