2023-06-07 23:37:23 +02:00
|
|
|
local h = require("null-ls.helpers")
|
|
|
|
local methods = require("null-ls.methods")
|
|
|
|
local u = require("null-ls.utils")
|
|
|
|
|
|
|
|
local FORMATTING = methods.internal.FORMATTING
|
|
|
|
|
|
|
|
local leptosfmt = h.make_builtin({
|
|
|
|
name = "leptosfmt",
|
|
|
|
meta = {
|
|
|
|
url = "https://github.com/bram209/leptosfmt",
|
|
|
|
description = "A formatter for the leptos view! macro"
|
|
|
|
},
|
|
|
|
method = FORMATTING,
|
|
|
|
filetypes = { "rust" },
|
|
|
|
generator_opts = {
|
|
|
|
command = "leptosfmt",
|
2023-07-04 19:05:19 +02:00
|
|
|
args = { "--quiet", "--stdin" },
|
2023-06-07 23:37:23 +02:00
|
|
|
to_stdin = true,
|
|
|
|
},
|
|
|
|
factory = h.formatter_factory,
|
|
|
|
})
|
|
|
|
|
|
|
|
|
2023-02-14 17:48:36 +01:00
|
|
|
return {
|
|
|
|
"jose-elias-alvarez/null-ls.nvim",
|
|
|
|
event = "BufReadPre",
|
|
|
|
dependencies = { "mason.nvim" },
|
|
|
|
opts = function()
|
|
|
|
local nls = require("null-ls")
|
|
|
|
return {
|
|
|
|
sources = {
|
|
|
|
nls.builtins.formatting.terraform_fmt,
|
2023-05-15 11:45:18 +02:00
|
|
|
--nls.builtins.formatting.yamlfmt,
|
2023-02-14 17:48:36 +01:00
|
|
|
nls.builtins.formatting.deno_fmt.with({
|
|
|
|
filetypes = { "markdown" }
|
|
|
|
}),
|
2023-05-15 11:45:18 +02:00
|
|
|
nls.builtins.formatting.golines,
|
|
|
|
nls.builtins.formatting.goimports_reviser,
|
|
|
|
nls.builtins.formatting.goimports,
|
|
|
|
nls.builtins.formatting.gofumpt,
|
|
|
|
nls.builtins.formatting.taplo,
|
2023-06-07 23:37:23 +02:00
|
|
|
nls.builtins.formatting.prettierd.with({
|
|
|
|
filetypes = { "graphql" }
|
|
|
|
}),
|
2023-05-15 11:45:18 +02:00
|
|
|
nls.builtins.code_actions.gitsigns,
|
|
|
|
nls.builtins.code_actions.refactoring,
|
2023-06-07 23:37:23 +02:00
|
|
|
nls.builtins.formatting.rustfmt.with({
|
|
|
|
extra_args = { "--edition=2021" },
|
|
|
|
filetypes = { "rust" }
|
|
|
|
}),
|
|
|
|
leptosfmt.with({
|
|
|
|
condition = function(utils)
|
|
|
|
return utils.root_has_file({ "leptosfmt.toml" })
|
|
|
|
end,
|
|
|
|
}),
|
2023-07-04 19:05:19 +02:00
|
|
|
nls.builtins.diagnostics.revive,
|
|
|
|
nls.builtins.code_actions.impl,
|
|
|
|
nls.builtins.code_actions.refactoring,
|
2023-02-14 17:48:36 +01:00
|
|
|
},
|
|
|
|
}
|
|
|
|
end,
|
|
|
|
}
|