feat: use LazyVim everywhere instead of require("lazyvim.util")

This commit is contained in:
Folke Lemaitre 2024-03-22 09:15:09 +01:00
parent 3a87c08cda
commit 7a5dbeae75
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
41 changed files with 188 additions and 229 deletions

View file

@ -1,5 +1,3 @@
local Util = require("lazyvim.util")
---@class lazyvim.util.lsp
local M = {}
@ -87,10 +85,10 @@ function M.formatter(opts)
primary = true,
priority = 1,
format = function(buf)
M.format(Util.merge({}, filter, { bufnr = buf }))
M.format(LazyVim.merge({}, filter, { bufnr = buf }))
end,
sources = function(buf)
local clients = M.get_clients(Util.merge({}, filter, { bufnr = buf }))
local clients = M.get_clients(LazyVim.merge({}, filter, { bufnr = buf }))
---@param client lsp.Client
local ret = vim.tbl_filter(function(client)
return client.supports_method("textDocument/formatting")
@ -102,7 +100,7 @@ function M.formatter(opts)
end, ret)
end,
}
return Util.merge(ret, opts) --[[@as LazyFormatter]]
return LazyVim.merge(ret, opts) --[[@as LazyFormatter]]
end
---@alias lsp.Client.format {timeout_ms?: number, format_options?: table} | lsp.Client.filter
@ -113,8 +111,8 @@ function M.format(opts)
"force",
{},
opts or {},
require("lazyvim.util").opts("nvim-lspconfig").format or {},
require("lazyvim.util").opts("conform.nvim").format or {}
LazyVim.opts("nvim-lspconfig").format or {},
LazyVim.opts("conform.nvim").format or {}
)
local ok, conform = pcall(require, "conform")
-- use conform for formatting with LSP when available,