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:
Artem Krinitsyn
2026-07-21 20:32:13 +03:00
committed by GitHub
parent 008ea4dd65
commit 9180c6e093

View File

@@ -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