aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/lua/vim')
-rw-r--r--runtime/lua/vim/lsp.lua4
-rw-r--r--runtime/lua/vim/lsp/diagnostic.lua11
-rw-r--r--runtime/lua/vim/lsp/util.lua1
3 files changed, 9 insertions, 7 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 92f56b2ddf..f082fe29f2 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1032,9 +1032,9 @@ function lsp.buf_request(bufnr, method, params, handler)
end
end)
- -- if no clients support the given method, call the handler with the proper
+ -- if has client but no clients support the given method, call the callback with the proper
-- error message.
- if not method_supported then
+ if not tbl_isempty(all_buffer_active_clients[resolve_bufnr(bufnr)] or {}) and not method_supported then
local unsupported_err = lsp._unsupported_method(method)
handler = handler or lsp.handlers[method]
if handler then
diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua
index 1570d4a122..27a1f53f89 100644
--- a/runtime/lua/vim/lsp/diagnostic.lua
+++ b/runtime/lua/vim/lsp/diagnostic.lua
@@ -308,15 +308,16 @@ end
--- Get all diagnostics for all clients
---
----@return Diagnostic[]
+---@return {bufnr: Diagnostic[]}
function M.get_all()
- local all_diagnostics = {}
- for _, buf_diagnostics in pairs(diagnostic_cache) do
+ local diagnostics_by_bufnr = {}
+ for bufnr, buf_diagnostics in pairs(diagnostic_cache) do
+ diagnostics_by_bufnr[bufnr] = {}
for _, client_diagnostics in pairs(buf_diagnostics) do
- vim.list_extend(all_diagnostics, client_diagnostics)
+ vim.list_extend(diagnostics_by_bufnr[bufnr], client_diagnostics)
end
end
- return all_diagnostics
+ return diagnostics_by_bufnr
end
--- Return associated diagnostics for bufnr
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index f78a36fda2..5804ac6656 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -957,6 +957,7 @@ function M.open_floating_preview(contents, filetype, opts)
end
api.nvim_buf_set_lines(floating_bufnr, 0, -1, true, contents)
api.nvim_buf_set_option(floating_bufnr, 'modifiable', false)
+ api.nvim_buf_set_option(floating_bufnr, 'bufhidden', 'wipe')
M.close_preview_autocmd({"CursorMoved", "CursorMovedI", "BufHidden", "BufLeave"}, floating_winnr)
return floating_bufnr, floating_winnr
end