From 285ea2525fdf31052f26575154ebf3a10f320f02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Fri, 4 Jul 2025 14:12:06 -0700 Subject: [PATCH 1/2] fix(lsp): remove extra notify on empty hover --- runtime/lua/vim/lsp/buf.lua | 7 ------- 1 file changed, 7 deletions(-) diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index b0a69fee04..4adaf8e16e 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -128,13 +128,6 @@ function M.hover(config) -- Remove last linebreak ('---') contents[#contents] = nil - if vim.tbl_isempty(contents) then - if config.silent ~= true then - vim.notify('No information available') - end - return - end - local _, winid = lsp.util.open_floating_preview(contents, format, config) api.nvim_create_autocmd('WinClosed', { From 3342aead1df99ed3f48c84dd1f5db7216bba8404 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maria=20Jos=C3=A9=20Solano?= Date: Fri, 4 Jul 2025 14:15:23 -0700 Subject: [PATCH 2/2] fix(lsp): consistent use of `vim.notify`/logging with unsupported methods --- runtime/lua/vim/lsp/buf.lua | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index 4adaf8e16e..0bca2e61e6 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -872,7 +872,7 @@ local hierarchy_methods = { local function hierarchy(method) local kind = hierarchy_methods[method] if not kind then - error('unsupported method ' .. method) + vim.notify(lsp._unsupported_method(method), vim.log.levels.WARN) end local prepare_method = kind == 'type' and ms.textDocument_prepareTypeHierarchy @@ -1275,9 +1275,7 @@ function M.code_action(opts) local win = api.nvim_get_current_win() local clients = lsp.get_clients({ bufnr = bufnr, method = ms.textDocument_codeAction }) if not next(clients) then - if next(lsp.get_clients({ bufnr = bufnr })) then - vim.notify(lsp._unsupported_method(ms.textDocument_codeAction), vim.log.levels.WARN) - end + vim.notify(lsp._unsupported_method(ms.textDocument_codeAction), vim.log.levels.WARN) return end