Skip to content

Commit fea6fd3

Browse files
committed
fix(lsp): disable custom handlers for Neovim 0.11+
- Skip custom LSP handlers in Neovim 0.11 and newer. - Retain support for Neovim 0.10 with custom hover and signature help handlers. - Comment out and remove broken "goto definition" handler for split window. - This feature doesn't function as expected and may be revisited later.
1 parent 71e1f2b commit fea6fd3

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

lua/plugins/lsp/handlers/init.lua

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,25 @@
1-
-- Define LSP handlers to be exported globally
1+
-- Define custom LSP handlers with global export
2+
-- TODO: handlers are deprecated and should be removed in Neovim 0.13.
23

4+
-- Skip loading in newer versions of Neovim (0.11+).
5+
if vim.fn.has("nvim-0.11") == 1 then
6+
return
7+
end
8+
9+
-- FIXME: Custom "goto definition" handler for split window not working.
10+
-- local definition = require("plugins.lsp.handlers.definition")
11+
-- vim.lsp.handlers["textDocument/definition"] = definition.goto_definition
12+
13+
-- Hover handler with custom border style
14+
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
15+
border = vim.g.border,
16+
})
17+
18+
-- NOTE: Doesn't seem to work with signatureHelp plugin
19+
-- Signature help handler with custom border and close events
320
vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, {
421
border = vim.g.border,
522
close_events = { "BufHidden", "CursorMoved", "CursorMovedI", "InsertCharPre" },
623
focusable = false,
724
silent = true,
825
})
9-
10-
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
11-
border = vim.g.border,
12-
})
13-
14-
local definition = require("plugins.lsp.handlers.definition")
15-
vim.lsp.handlers["textDocument/definition"] = definition.goto_definition

0 commit comments

Comments
 (0)