mirror of
https://github.com/neovim/neovim.git
synced 2024-09-17 20:58:20 -04:00
fix(lsp): check buffer is loaded and valid #30330
Problem: buffer mabye not valid when callback handler invoke. Soliton: check buffer is valid and loaded in handler.
This commit is contained in:
parent
a30afeeb85
commit
f9bf64d746
@ -43,17 +43,16 @@ function M.on_inlayhint(err, result, ctx, _)
|
||||
return
|
||||
end
|
||||
local bufnr = assert(ctx.bufnr)
|
||||
if util.buf_versions[bufnr] ~= ctx.version then
|
||||
if
|
||||
util.buf_versions[bufnr] ~= ctx.version
|
||||
or not result
|
||||
or not api.nvim_buf_is_loaded(bufnr)
|
||||
or not bufstates[bufnr].enabled
|
||||
then
|
||||
return
|
||||
end
|
||||
local client_id = ctx.client_id
|
||||
if not result then
|
||||
return
|
||||
end
|
||||
local bufstate = bufstates[bufnr]
|
||||
if not bufstate.enabled then
|
||||
return
|
||||
end
|
||||
if not (bufstate.client_hints and bufstate.version) then
|
||||
bufstate.client_hints = vim.defaulttable()
|
||||
bufstate.version = ctx.version
|
||||
|
Loading…
Reference in New Issue
Block a user