mirror of
https://github.com/LazyVim/LazyVim.git
synced 2025-07-07 16:04:35 +02:00
fix(lsp): dont try to highlight refs for deleted buffers
This commit is contained in:
parent
47c90209f3
commit
87493af237
1 changed files with 8 additions and 0 deletions
|
@ -135,6 +135,14 @@ function M.words.setup(opts)
|
|||
if not opts.enabled then
|
||||
return
|
||||
end
|
||||
local handler = vim.lsp.handlers["textDocument/documentHighlight"]
|
||||
vim.lsp.handlers["textDocument/documentHighlight"] = function(err, result, ctx, config)
|
||||
if not vim.api.nvim_buf_is_loaded(ctx.bufnr) then
|
||||
return
|
||||
end
|
||||
return handler(err, result, ctx, config)
|
||||
end
|
||||
|
||||
M.on_attach(function(client, buf)
|
||||
if client.supports_method("textDocument/documentHighlight") then
|
||||
vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI", "CursorMoved", "CursorMovedI" }, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue