feat(neovim): add tsserver config
parent
91d13168c0
commit
ab0890f274
|
@ -22,13 +22,18 @@ local on_attach = function(client, bufnr)
|
||||||
nnoremap("<C-p>", vim.diagnostic.goto_prev)
|
nnoremap("<C-p>", vim.diagnostic.goto_prev)
|
||||||
nnoremap("<C-n>", vim.diagnostic.goto_next)
|
nnoremap("<C-n>", vim.diagnostic.goto_next)
|
||||||
|
|
||||||
|
-- disable tsserver formatting
|
||||||
|
if client.name == "tsserver" then
|
||||||
|
client.resolved_capabilities["document_formatting"] = false
|
||||||
|
end
|
||||||
|
|
||||||
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 })
|
||||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||||
group = augroup,
|
group = augroup,
|
||||||
buffer = bufnr,
|
buffer = bufnr,
|
||||||
callback = function()
|
callback = function()
|
||||||
vim.lsp.buf.formatting_sync({}, 3000)
|
vim.lsp.buf.formatting_sync(nil, 3000)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
@ -54,6 +59,7 @@ local servers = {
|
||||||
["rnix"] = {},
|
["rnix"] = {},
|
||||||
["terraformls"] = {},
|
["terraformls"] = {},
|
||||||
["tflint"] = {},
|
["tflint"] = {},
|
||||||
|
["tsserver"] = {},
|
||||||
["yamlls"] = {},
|
["yamlls"] = {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,9 +105,10 @@ lspconfig["sumneko_lua"].setup(luadev)
|
||||||
local null_ls = require("null-ls")
|
local null_ls = require("null-ls")
|
||||||
null_ls.setup({
|
null_ls.setup({
|
||||||
sources = {
|
sources = {
|
||||||
null_ls.builtins.formatting.prettier.with({
|
null_ls.builtins.formatting.prettier,
|
||||||
filetypes = { "markdown" }
|
null_ls.builtins.code_actions.eslint_d,
|
||||||
}),
|
null_ls.builtins.diagnostics.eslint_d,
|
||||||
|
null_ls.builtins.diagnostics.tsc,
|
||||||
},
|
},
|
||||||
|
|
||||||
on_attach = on_attach,
|
on_attach = on_attach,
|
||||||
|
|
Loading…
Reference in New Issue