Fixed ts formatting with tsserver
This commit is contained in:
@@ -45,13 +45,7 @@ return {
|
|||||||
|
|
||||||
lspconfig["eslint"].setup({
|
lspconfig["eslint"].setup({
|
||||||
capabilities = capabilities,
|
capabilities = capabilities,
|
||||||
on_attach = function(client, bufnr)
|
on_attach = on_attach,
|
||||||
on_attach(client, bufnr)
|
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
|
||||||
buffer = bufnr,
|
|
||||||
command = "EslintFixAll",
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
})
|
})
|
||||||
|
|
||||||
lspconfig["lua_ls"].setup({
|
lspconfig["lua_ls"].setup({
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
--- @type LazyPluginSpec
|
--- @type LazyPluginSpec
|
||||||
return {
|
return {
|
||||||
-- "jose-elias-alvarez/null-ls.nvim",
|
|
||||||
"nvimtools/none-ls.nvim",
|
"nvimtools/none-ls.nvim",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
config = function()
|
config = function()
|
||||||
@@ -14,7 +13,6 @@ return {
|
|||||||
sources = {
|
sources = {
|
||||||
formatting.stylua,
|
formatting.stylua,
|
||||||
},
|
},
|
||||||
|
|
||||||
on_attach = function(client, bufnr)
|
on_attach = function(client, bufnr)
|
||||||
if client.supports_method("textDocument/formatting") then
|
if client.supports_method("textDocument/formatting") then
|
||||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||||
@@ -25,17 +23,6 @@ return {
|
|||||||
vim.lsp.buf.format({ async = false })
|
vim.lsp.buf.format({ async = false })
|
||||||
end,
|
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
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -18,10 +18,21 @@ return {
|
|||||||
|
|
||||||
local on_attach = require("taken.utils.on_attach")
|
local on_attach = require("taken.utils.on_attach")
|
||||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||||
|
local augroup = vim.api.nvim_create_augroup("Typescript_tools", {})
|
||||||
|
|
||||||
typescript_tools.setup({
|
typescript_tools.setup({
|
||||||
capabilities = capabilities,
|
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 = {
|
settings = {
|
||||||
tsserver_file_preferences = {
|
tsserver_file_preferences = {
|
||||||
includeCompletionsForModuleExports = true,
|
includeCompletionsForModuleExports = true,
|
||||||
|
|||||||
Reference in New Issue
Block a user