mirror of
https://github.com/neovim/neovim.git
synced 2026-07-31 04:39:07 +00:00
fix(lsp): guard linked_editing_range refresh on attach (#40888)
Problem: on_attach() calls refresh(), but there is no guarantee the attached buffer is the current buffer. This can make linked editing request handling assume the wrong window. Solution: Call refresh() only if the current buffer is attached. This keeps the initial highlighting behavior while avoiding making incorrect request.
This commit is contained in:
@@ -195,7 +195,9 @@ function LinkedEditor:on_attach(client_id)
|
||||
self.client_state[client_id] = state
|
||||
end
|
||||
|
||||
self:refresh()
|
||||
if self.bufnr == api.nvim_get_current_buf() then
|
||||
self:refresh()
|
||||
end
|
||||
end
|
||||
|
||||
---@package
|
||||
|
||||
Reference in New Issue
Block a user