From ab0890f274073c158d74295e6975f6e2c85aa14c Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Wed, 27 Jul 2022 16:23:11 +0200 Subject: [PATCH] feat(neovim): add tsserver config --- home-manager/neovim/lspconfig.lua | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/home-manager/neovim/lspconfig.lua b/home-manager/neovim/lspconfig.lua index db099e2..d9704b5 100644 --- a/home-manager/neovim/lspconfig.lua +++ b/home-manager/neovim/lspconfig.lua @@ -22,13 +22,18 @@ local on_attach = function(client, bufnr) nnoremap("", vim.diagnostic.goto_prev) nnoremap("", 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,