style: lua annotations and handle deprecated methods

This commit is contained in:
Folke Lemaitre
2023-10-08 10:45:38 +02:00
parent 21ee35f710
commit 6b837e9165
3 changed files with 20 additions and 13 deletions

View File

@ -82,7 +82,7 @@ function M.get_formatters(bufnr)
}
---@type lsp.Client[]
local clients = vim.lsp.get_active_clients({ bufnr = bufnr })
local clients = require("lazyvim.util").get_clients({ bufnr = bufnr })
for _, client in ipairs(clients) do
if M.supports_format(client) then
if (#null_ls > 0 and client.name == "null-ls") or #null_ls == 0 then

View File

@ -66,7 +66,7 @@ end
---@param method string
function M.has(buffer, method)
method = method:find("/") and method or "textDocument/" .. method
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
local clients = require("lazyvim.util").get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
if client.supports_method(method) then
return true
@ -83,7 +83,7 @@ function M.resolve(buffer)
end
local spec = M.get()
local opts = require("lazyvim.util").opts("nvim-lspconfig")
local clients = vim.lsp.get_active_clients({ bufnr = buffer })
local clients = require("lazyvim.util").get_clients({ bufnr = buffer })
for _, client in ipairs(clients) do
local maps = opts.servers[client.name] and opts.servers[client.name].keys or {}
vim.list_extend(spec, maps)
@ -98,7 +98,6 @@ function M.on_attach(_, buffer)
for _, keys in pairs(keymaps) do
if not keys.has or M.has(buffer, keys.has) then
local opts = Keys.opts(keys)
---@diagnostic disable-next-line: no-unknown
opts.has = nil
opts.silent = opts.silent ~= false
opts.buffer = buffer