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

View file

@ -38,7 +38,7 @@ end
--- @param bufnr int? buffer number
--- @return table all active LSP client names
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 = {}
for _, client in ipairs(clients) do