mirror of
https://github.com/neovim/neovim.git
synced 2026-08-03 14:19:15 +00:00
backport: fix(lsp): guard linked_editing_range refresh on attach (#40900)
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.
(cherry picked from commit 9180c6e093)
This commit is contained in:
@@ -249,7 +249,9 @@ local function attach_linked_editor(bufnr, client)
|
||||
|
||||
local linked_editor = LinkedEditor.active[bufnr] or LinkedEditor.new(bufnr)
|
||||
linked_editor:attach(client_id)
|
||||
linked_editor:refresh()
|
||||
if bufnr == api.nvim_get_current_buf() then
|
||||
linked_editor:refresh()
|
||||
end
|
||||
end
|
||||
|
||||
---@param bufnr integer
|
||||
|
||||
Reference in New Issue
Block a user