Fixed ts formatting with tsserver

This commit is contained in:
2024-03-23 18:02:44 +01:00
parent 980e542a2c
commit 77e1951e12
3 changed files with 13 additions and 21 deletions

View File

@@ -1,6 +1,5 @@
--- @type LazyPluginSpec
return {
-- "jose-elias-alvarez/null-ls.nvim",
"nvimtools/none-ls.nvim",
event = { "BufReadPre", "BufNewFile" },
config = function()
@@ -14,7 +13,6 @@ return {
sources = {
formatting.stylua,
},
on_attach = function(client, bufnr)
if client.supports_method("textDocument/formatting") then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
@@ -25,17 +23,6 @@ return {
vim.lsp.buf.format({ async = false })
end,
})
elseif client.server_capabilities.documentFormattingProvider then
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
vim.api.nvim_create_autocmd("BufWritePre", {
group = augroup,
buffer = bufnr,
callback = function()
vim.lsp.buf.format({ async = false })
end,
})
else
vim.notify("Formatting not supported")
end
end,
})