feat: ts formatting
This commit is contained in:
parent
1e499dccba
commit
c45475a62d
|
@ -103,12 +103,12 @@ function M.setup()
|
||||||
settings = {rootMarkers = {".git/"}, languages = efmLanguages}
|
settings = {rootMarkers = {".git/"}, languages = efmLanguages}
|
||||||
}
|
}
|
||||||
|
|
||||||
local autoFormatOn = {lua = 200, purs = 1000, nix = 200, js = 300, ts = 300, tsx = 300, jsx = 300}
|
local autoFormatOn = {lua = 200, purs = 1000, nix = 200, ts = 200, js = 200, json = 200, scss = 200, tsx = 200, jsx = 200}
|
||||||
|
|
||||||
-- Auto format
|
-- Auto format
|
||||||
for extension, timeout in pairs(autoFormatOn) do
|
for extension, timeout in pairs(autoFormatOn) do
|
||||||
-- I wonder if this could be done in a single glob pattern
|
-- I wonder if this could be done in a single glob pattern
|
||||||
cmd("autocmd BufWritePre *." .. extension .. " lua vim.lsp.buf.formatting_sync(nil, " .. timeout .. ")")
|
cmd("autocmd BufWritePre *." .. extension .. " lua vim.lsp.buf.formatting_sync()")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
function M.setup()
|
function M.setup()
|
||||||
-- Setup goes here
|
local null_ls = require("null-ls")
|
||||||
|
|
||||||
|
local sources = {
|
||||||
|
null_ls.builtins.formatting.prettierd -- format ts files
|
||||||
|
}
|
||||||
|
|
||||||
|
null_ls.setup({sources = sources})
|
||||||
end
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|
Loading…
Reference in a new issue