diff --git a/lua/lazyvim/plugins/extras/ai/copilot.lua b/lua/lazyvim/plugins/extras/ai/copilot.lua index deebcd7d..48870743 100644 --- a/lua/lazyvim/plugins/extras/ai/copilot.lua +++ b/lua/lazyvim/plugins/extras/ai/copilot.lua @@ -49,7 +49,7 @@ return { opts.sections.lualine_x, 2, LazyVim.lualine.status(LazyVim.config.icons.kinds.Copilot, function() - local clients = package.loaded["copilot"] and LazyVim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} + local clients = package.loaded["copilot"] and vim.lsp.get_clients({ name = "copilot", bufnr = 0 }) or {} if #clients > 0 then local status = require("copilot.status").data.status return (status == "InProgress" and "pending") or (status == "Warning" and "error") or "ok" diff --git a/lua/lazyvim/plugins/extras/editor/fzf.lua b/lua/lazyvim/plugins/extras/editor/fzf.lua index e9177457..31297b94 100644 --- a/lua/lazyvim/plugins/extras/editor/fzf.lua +++ b/lua/lazyvim/plugins/extras/editor/fzf.lua @@ -122,7 +122,7 @@ return { -- height is number of items minus 15 lines for the preview, with a max of 80% screen height height = math.floor(math.min(vim.o.lines * 0.8 - 16, #items + 2) + 0.5) + 16, width = 0.5, - preview = not vim.tbl_isempty(LazyVim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { + preview = not vim.tbl_isempty(vim.lsp.get_clients({ bufnr = 0, name = "vtsls" })) and { layout = "vertical", vertical = "down:15,border-top", hidden = "hidden", diff --git a/lua/lazyvim/plugins/extras/linting/eslint.lua b/lua/lazyvim/plugins/extras/linting/eslint.lua index 01f134e2..92c670d4 100644 --- a/lua/lazyvim/plugins/extras/linting/eslint.lua +++ b/lua/lazyvim/plugins/extras/linting/eslint.lua @@ -27,7 +27,7 @@ return { end local function get_client(buf) - return LazyVim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] + return vim.lsp.get_clients({ name = "eslint", bufnr = buf })[1] end local formatter = LazyVim.lsp.formatter({ diff --git a/lua/lazyvim/plugins/lsp/keymaps.lua b/lua/lazyvim/plugins/lsp/keymaps.lua index 748f5b29..9cde08c1 100644 --- a/lua/lazyvim/plugins/lsp/keymaps.lua +++ b/lua/lazyvim/plugins/lsp/keymaps.lua @@ -52,7 +52,7 @@ function M.has(buffer, method) return false end method = method:find("/") and method or "textDocument/" .. method - local clients = LazyVim.lsp.get_clients({ bufnr = buffer }) + local clients = vim.lsp.get_clients({ bufnr = buffer }) for _, client in ipairs(clients) do if client:supports_method(method) then return true @@ -69,7 +69,7 @@ function M.resolve(buffer) end local spec = vim.tbl_extend("force", {}, M.get()) local opts = LazyVim.opts("nvim-lspconfig") - local clients = LazyVim.lsp.get_clients({ bufnr = buffer }) + local clients = vim.lsp.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) diff --git a/lua/lazyvim/util/lsp.lua b/lua/lazyvim/util/lsp.lua index 632a7b9f..a857422f 100644 --- a/lua/lazyvim/util/lsp.lua +++ b/lua/lazyvim/util/lsp.lua @@ -1,15 +1,6 @@ ---@class lazyvim.util.lsp local M = {} ----@alias lsp.Client.filter {id?: number, bufnr?: number, name?: string, method?: string, filter?:fun(client: vim.lsp.Client):boolean} - ----@param opts? lsp.Client.filter -function M.get_clients(opts) - local ret = {} ---@type vim.lsp.Client[] - ret = vim.lsp.get_clients(opts) - return opts and opts.filter and vim.tbl_filter(opts.filter, ret) or ret -end - ---@param on_attach fun(client:vim.lsp.Client, buffer) ---@param name? string function M.on_attach(on_attach, name) @@ -107,12 +98,12 @@ function M.on_supports_method(method, fn) }) end ----@param opts? LazyFormatter| {filter?: (string|lsp.Client.filter)} +---@param opts? LazyFormatter| {filter?: (string|vim.lsp.get_clients.Filter)} function M.formatter(opts) opts = opts or {} local filter = opts.filter or {} filter = type(filter) == "string" and { name = filter } or filter - ---@cast filter lsp.Client.filter + ---@cast filter vim.lsp.get_clients.Filter ---@type LazyFormatter local ret = { name = "LSP", @@ -122,7 +113,7 @@ function M.formatter(opts) M.format(LazyVim.merge({}, filter, { bufnr = buf })) end, sources = function(buf) - local clients = M.get_clients(LazyVim.merge({}, filter, { bufnr = buf })) + local clients = vim.lsp.get_clients(LazyVim.merge({}, filter, { bufnr = buf })) ---@param client vim.lsp.Client local ret = vim.tbl_filter(function(client) return client:supports_method("textDocument/formatting") @@ -137,7 +128,7 @@ function M.formatter(opts) return LazyVim.merge(ret, opts) --[[@as LazyFormatter]] end ----@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter +---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | vim.lsp.get_clients.Filter ---@param opts? lsp.Client.format function M.format(opts) diff --git a/lua/lazyvim/util/root.lua b/lua/lazyvim/util/root.lua index fc6d6d7d..b3d68721 100644 --- a/lua/lazyvim/util/root.lua +++ b/lua/lazyvim/util/root.lua @@ -29,10 +29,10 @@ function M.detectors.lsp(buf) return {} end local roots = {} ---@type string[] - local clients = LazyVim.lsp.get_clients({ bufnr = buf }) + local clients = vim.lsp.get_clients({ bufnr = buf }) clients = vim.tbl_filter(function(client) return not vim.tbl_contains(vim.g.root_lsp_ignore or {}, client.name) - end, clients) + end, clients) --[[@as vim.lsp.Client[] ]] for _, client in pairs(clients) do local workspace = client.config.workspace_folders for _, ws in pairs(workspace or {}) do