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-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
|
||||
vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr })
|
||||
vim.api.nvim_create_autocmd("BufWritePre", {
|
||||
group = augroup,
|
||||
buffer = bufnr,
|
||||
callback = function()
|
||||
vim.lsp.buf.formatting_sync({}, 3000)
|
||||
vim.lsp.buf.formatting_sync(nil, 3000)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
@ -54,6 +59,7 @@ local servers = {
|
|||
["rnix"] = {},
|
||||
["terraformls"] = {},
|
||||
["tflint"] = {},
|
||||
["tsserver"] = {},
|
||||
["yamlls"] = {},
|
||||
}
|
||||
|
||||
|
@ -99,9 +105,10 @@ lspconfig["sumneko_lua"].setup(luadev)
|
|||
local null_ls = require("null-ls")
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.prettier.with({
|
||||
filetypes = { "markdown" }
|
||||
}),
|
||||
null_ls.builtins.formatting.prettier,
|
||||
null_ls.builtins.code_actions.eslint_d,
|
||||
null_ls.builtins.diagnostics.eslint_d,
|
||||
null_ls.builtins.diagnostics.tsc,
|
||||
},
|
||||
|
||||
on_attach = on_attach,
|
||||
|
|
Loading…
Reference in New Issue