Skip to content

Commit

Permalink
fix(lsp): vim.lsp.handlers is deprecated for hover / signature_help. F…
Browse files Browse the repository at this point in the history
…ixes #977
  • Loading branch information
folke committed Nov 1, 2024
1 parent 0783e22 commit 3cd84d4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
8 changes: 4 additions & 4 deletions lua/noice/health.lua
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,14 @@ function M.check(opts)
{
opt = "lsp.hover",
enabled = Config.options.lsp.hover.enabled,
handler = vim.lsp.handlers["textDocument/hover"],
handler_str = 'vim.lsp.handlers["textDocument/hover"]',
handler = vim.lsp.buf.hover,
handler_str = "vim.lsp.buf.hover",
},
{
opt = "lsp.signature",
enabled = Config.options.lsp.signature.enabled,
handler = vim.lsp.handlers["textDocument/signatureHelp"],
handler_str = 'vim.lsp.handlers["textDocument/signatureHelp"]',
handler = vim.lsp.buf.signature_help,
handler_str = "vim.lsp.buf.signature_help",
},
{
opt = "lsp.message",
Expand Down
4 changes: 0 additions & 4 deletions lua/noice/lsp/hover.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ local Util = require("noice.util")

local M = {}

function M.setup()
vim.lsp.handlers["textDocument/hover"] = M.on_hover
end

function M.on_hover(_, result, ctx)
if not (result and result.contents) then
if Config.options.lsp.hover.silent ~= true then
Expand Down
3 changes: 2 additions & 1 deletion lua/noice/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ M.kinds = {

function M.setup()
if Config.options.lsp.hover.enabled then
require("noice.lsp.hover").setup()
vim.lsp.buf.hover = M.hover
end

if Config.options.lsp.signature.enabled then
require("noice.lsp.signature").setup()
vim.lsp.buf.signature_help = M.signature
end

if Config.options.lsp.message.enabled then
Expand Down
2 changes: 0 additions & 2 deletions lua/noice/lsp/signature.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ M.trigger_kind = {
}

function M.setup()
vim.lsp.handlers["textDocument/signatureHelp"] = M.on_signature

if Config.options.lsp.signature.auto_open.enabled then
-- attach to existing buffers
for _, client in ipairs((vim.lsp.get_clients or vim.lsp.get_active_clients)()) do
Expand Down

0 comments on commit 3cd84d4

Please sign in to comment.