mirror of
https://github.com/neovim/neovim.git
synced 2025-09-05 19:08:15 +00:00
fix(lsp): detach all clients on_reload to force buf_state reload (#28898)
Problem: The changetracking state can de-sync when reloading a buffer
with more than one LSP client attached.
Solution: Fully detach all clients from the buffer to force buf_state to
be re-created.
(cherry picked from commit 879d17ea8d
)
Co-authored-by: Ilia Choly <ilia.choly@gmail.com>
This commit is contained in:
![41898282+github-actions[bot]@users.noreply.github.com](/assets/img/avatar_default.png)
committed by
GitHub

parent
efe8a0a520
commit
3a727beafd
@@ -556,12 +556,15 @@ local function buf_attach(bufnr)
|
||||
end,
|
||||
|
||||
on_reload = function()
|
||||
local clients = lsp.get_clients({ bufnr = bufnr })
|
||||
local params = { textDocument = { uri = uri } }
|
||||
for _, client in ipairs(lsp.get_clients({ bufnr = bufnr })) do
|
||||
for _, client in ipairs(clients) do
|
||||
changetracking.reset_buf(client, bufnr)
|
||||
if vim.tbl_get(client.server_capabilities, 'textDocumentSync', 'openClose') then
|
||||
client.notify(ms.textDocument_didClose, params)
|
||||
end
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
client:_text_document_did_open_handler(bufnr)
|
||||
end
|
||||
end,
|
||||
|
Reference in New Issue
Block a user