added templ formatter
This commit is contained in:
+23
-8
@@ -260,7 +260,7 @@ function M.nvim_treesitter()
|
|||||||
"typescript",
|
"typescript",
|
||||||
"tsx",
|
"tsx",
|
||||||
"svelte",
|
"svelte",
|
||||||
"angular",
|
"angular",
|
||||||
|
|
||||||
"json",
|
"json",
|
||||||
"query",
|
"query",
|
||||||
@@ -270,9 +270,9 @@ function M.nvim_treesitter()
|
|||||||
"vim",
|
"vim",
|
||||||
|
|
||||||
"glimmer",
|
"glimmer",
|
||||||
"templ",
|
"templ",
|
||||||
"go",
|
"go",
|
||||||
"rust",
|
"rust",
|
||||||
},
|
},
|
||||||
highlight = {
|
highlight = {
|
||||||
enable = true,
|
enable = true,
|
||||||
@@ -315,9 +315,21 @@ function M.null_ls()
|
|||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
local config = lsp_config_defaults()
|
local config = lsp_config_defaults()
|
||||||
|
|
||||||
--local sqlfluff_args = {
|
local h = require("null-ls.helpers")
|
||||||
-- extra_args = { "--dialect", "postgres" },
|
local methods = require("null-ls.methods")
|
||||||
--}
|
local FORMATTING = methods.internal.FORMATTING
|
||||||
|
|
||||||
|
local templ_fmt = h.make_builtin({
|
||||||
|
name = "templ",
|
||||||
|
method = FORMATTING,
|
||||||
|
filetypes = { "templ" },
|
||||||
|
generator_opts = {
|
||||||
|
command = "templ",
|
||||||
|
args = { "fmt" },
|
||||||
|
to_stdin = true,
|
||||||
|
},
|
||||||
|
factory = h.formatter_factory,
|
||||||
|
})
|
||||||
|
|
||||||
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
-- ORDER IN TABLE DETERMINES EXECUTION ORDER
|
||||||
local sources = {
|
local sources = {
|
||||||
@@ -326,7 +338,6 @@ function M.null_ls()
|
|||||||
args = { "check", "-n", "-e", "--stdin-filename", "$FILENAME", "-" },
|
args = { "check", "-n", "-e", "--stdin-filename", "$FILENAME", "-" },
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.formatting.ruff.with({
|
null_ls.builtins.formatting.ruff.with({
|
||||||
--extra_args = { "--extend-select", "I001", "--unfixable", "F841,F842,F401" },
|
|
||||||
args = { "format", "--stdin-filename", "$FILENAME", "-" },
|
args = { "format", "--stdin-filename", "$FILENAME", "-" },
|
||||||
}),
|
}),
|
||||||
null_ls.builtins.formatting.ruff.with({
|
null_ls.builtins.formatting.ruff.with({
|
||||||
@@ -355,6 +366,7 @@ function M.null_ls()
|
|||||||
-- golang
|
-- golang
|
||||||
--null_ls.builtins.diagnostics.golangci_lint,
|
--null_ls.builtins.diagnostics.golangci_lint,
|
||||||
null_ls.builtins.formatting.gofmt,
|
null_ls.builtins.formatting.gofmt,
|
||||||
|
templ_fmt,
|
||||||
|
|
||||||
-- sql
|
-- sql
|
||||||
-- null_ls.builtins.diagnostics.sqlfluff.with(sqlfluff_args),
|
-- null_ls.builtins.diagnostics.sqlfluff.with(sqlfluff_args),
|
||||||
@@ -501,6 +513,9 @@ function M.lsp_zero()
|
|||||||
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
client.notify("$/onDidChangeTsOrJsFile", { uri = ctx.file })
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
elseif client.name == "html" then
|
||||||
|
client.server_capabilities.documentFormattingProvider = false
|
||||||
|
client.server_capabilities.documentRangeFormattingProvider = false
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user