feat: use LazyVim everywhere instead of require("lazyvim.util")
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
local Util = require("lazyvim.util")
|
||||
|
||||
local M = {}
|
||||
|
||||
---@param opts ConformOpts
|
||||
@ -10,14 +8,17 @@ function M.setup(_, opts)
|
||||
if formatter.extra_args then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
formatter.prepend_args = formatter.extra_args
|
||||
Util.deprecate(("opts.formatters.%s.extra_args"):format(name), ("opts.formatters.%s.prepend_args"):format(name))
|
||||
LazyVim.deprecate(
|
||||
("opts.formatters.%s.extra_args"):format(name),
|
||||
("opts.formatters.%s.prepend_args"):format(name)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
for _, key in ipairs({ "format_on_save", "format_after_save" }) do
|
||||
if opts[key] then
|
||||
Util.warn(
|
||||
LazyVim.warn(
|
||||
("Don't set `opts.%s` for `conform.nvim`.\n**LazyVim** will use the conform formatter automatically"):format(
|
||||
key
|
||||
)
|
||||
@ -47,8 +48,8 @@ return {
|
||||
},
|
||||
init = function()
|
||||
-- Install the conform formatter on VeryLazy
|
||||
require("lazyvim.util").on_very_lazy(function()
|
||||
require("lazyvim.util").format.register({
|
||||
LazyVim.on_very_lazy(function()
|
||||
LazyVim.format.register({
|
||||
name = "conform.nvim",
|
||||
priority = 100,
|
||||
primary = true,
|
||||
@ -56,7 +57,7 @@ return {
|
||||
local plugin = require("lazy.core.config").plugins["conform.nvim"]
|
||||
local Plugin = require("lazy.core.plugin")
|
||||
local opts = Plugin.values(plugin, "opts", false)
|
||||
require("conform").format(Util.merge({}, opts.format, { bufnr = buf }))
|
||||
require("conform").format(LazyVim.merge({}, opts.format, { bufnr = buf }))
|
||||
end,
|
||||
sources = function(buf)
|
||||
local ret = require("conform").list_formatters(buf)
|
||||
@ -71,7 +72,7 @@ return {
|
||||
opts = function()
|
||||
local plugin = require("lazy.core.config").plugins["conform.nvim"]
|
||||
if plugin.config ~= M.setup then
|
||||
Util.error({
|
||||
LazyVim.error({
|
||||
"Don't set `plugin.config` for `conform.nvim`.\n",
|
||||
"This will break **LazyVim** formatting.\n",
|
||||
"Please refer to the docs at https://www.lazyvim.org/plugins/formatting",
|
||||
|
Reference in New Issue
Block a user