diff options
author | Ilia Choly <ilia.choly@gmail.com> | 2024-05-21 14:02:48 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 20:02:48 +0200 |
commit | 879d17ea8d62c199ea0c91c5f37a4f25495be7ce (patch) | |
tree | d96ee486b6c4cdd2b497490718b909af0c762ef3 /runtime/lua/vim | |
parent | 56b7a18995681b3e732f8fa460ef378e7044f990 (diff) | |
download | rneovim-879d17ea8d62c199ea0c91c5f37a4f25495be7ce.tar.gz rneovim-879d17ea8d62c199ea0c91c5f37a4f25495be7ce.tar.bz2 rneovim-879d17ea8d62c199ea0c91c5f37a4f25495be7ce.zip |
fix(lsp): detach all clients on_reload to force buf_state reload (#28875)
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.
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 8751cff902..6f12bc457b 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -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, |