home: vim: fix deprecated calls

This commit is contained in:
Bruno BELANYI 2025-03-29 16:17:59 +00:00
parent dfb3c353ec
commit 274d143031
2 changed files with 8 additions and 11 deletions

View file

@ -5,14 +5,15 @@ local lsp_format = require("lsp-format")
--- Move to the next/previous diagnostic, automatically showing the diagnostics --- Move to the next/previous diagnostic, automatically showing the diagnostics
--- float if necessary. --- float if necessary.
--- @param forward bool whether to go forward or backwards --- @param count number whether to go count or backwards
local function goto_diagnostic(forward) local function goto_diagnostic(count)
vim.validate({ vim.validate({
forward = { forward, "boolean" }, count = { count, "number" },
}) })
local opts = { local opts = {
float = false, float = false,
count = count,
} }
-- Only show floating diagnostics if they are otherwise not displayed -- Only show floating diagnostics if they are otherwise not displayed
@ -21,23 +22,19 @@ local function goto_diagnostic(forward)
opts.float = true opts.float = true
end end
if forward then vim.diagnostic.jump(opts)
vim.diagnostic.goto_next(opts)
else
vim.diagnostic.goto_prev(opts)
end
end end
--- Move to the next diagnostic, automatically showing the diagnostics float if --- Move to the next diagnostic, automatically showing the diagnostics float if
--- necessary. --- necessary.
M.goto_next_diagnostic = function() M.goto_next_diagnostic = function()
goto_diagnostic(true) goto_diagnostic(1)
end end
--- Move to the previous diagnostic, automatically showing the diagnostics float --- Move to the previous diagnostic, automatically showing the diagnostics float
--- if necessary. --- if necessary.
M.goto_prev_diagnostic = function() M.goto_prev_diagnostic = function()
goto_diagnostic(false) goto_diagnostic(-1)
end end
--- shared LSP configuration callback --- shared LSP configuration callback

View file

@ -38,7 +38,7 @@ end
--- @param bufnr int? buffer number --- @param bufnr int? buffer number
--- @return table all active LSP client names --- @return table all active LSP client names
M.list_lsp_clients = function(bufnr) M.list_lsp_clients = function(bufnr)
local clients = vim.lsp.get_active_clients({ bufnr = bufnr }) local clients = vim.lsp.get_clients({ bufnr = bufnr })
local names = {} local names = {}
for _, client in ipairs(clients) do for _, client in ipairs(clients) do