Fixed ts formatting with tsserver
This commit is contained in:
@@ -45,13 +45,7 @@ return {
|
||||
|
||||
lspconfig["eslint"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
buffer = bufnr,
|
||||
command = "EslintFixAll",
|
||||
})
|
||||
end,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig["lua_ls"].setup({
|
||||
|
||||
@@ -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,
|
||||
})
|
||||
|
||||
@@ -18,10 +18,21 @@ return {
|
||||
|
||||
local on_attach = require("taken.utils.on_attach")
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
local augroup = vim.api.nvim_create_augroup("Typescript_tools", {})
|
||||
|
||||
typescript_tools.setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
on_attach = function(client, bufnr)
|
||||
on_attach(client, bufnr)
|
||||
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,
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
tsserver_file_preferences = {
|
||||
includeCompletionsForModuleExports = true,
|
||||
|
||||
Reference in New Issue
Block a user