From 223f47bad2b3e977b295cb5bf9f193278c23de00 Mon Sep 17 00:00:00 2001 From: Daniel Kempkens Date: Fri, 10 Dec 2021 00:06:07 +0100 Subject: [PATCH] LSP: Fix tsserver --- config/nvim/lua/nifoc/config/lsp.lua | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/config/nvim/lua/nifoc/config/lsp.lua b/config/nvim/lua/nifoc/config/lsp.lua index 74d866b..e1cb65e 100644 --- a/config/nvim/lua/nifoc/config/lsp.lua +++ b/config/nvim/lua/nifoc/config/lsp.lua @@ -35,6 +35,11 @@ local function custom_attach(client, bufnr) vim.api.nvim_command('doautocmd User NifocLspAttached') end +local function custom_attach_no_format(client, bufnr) + client.resolved_capabilities.document_formatting = false + custom_attach(client, bufnr) +end + -- Setup vim.cmd('sign define LspDiagnosticsSignError text= texthl=LspDiagnosticsSignError linehl= numhl=') @@ -91,16 +96,11 @@ end -- Default configuration without formatting -local default_servers_no_formatting = { - 'tsserver' -} +local default_servers_no_formatting = {} for _, name in ipairs(default_servers_no_formatting) do lsp[name].setup(vim.tbl_extend('force', default_config, { - on_attach = function(client, bufnr) - client.resolved_capabilities.document_formatting = false - custom_attach(client, bufnr) - end, + on_attach = custom_attach_no_format, })) end @@ -110,6 +110,11 @@ lsp.elixirls.setup(vim.tbl_extend('force', default_config, { cmd = { 'elixir-ls' }, })) +lsp.tsserver.setup(vim.tbl_extend('force', default_config, { + cmd = { 'typescript-language-server', '--stdio', '--tsserver-path', 'tsserver'}, + on_attach = custom_attach_no_format, +})) + lsp.jsonls.setup(vim.tbl_extend('force', default_config, { cmd = { 'vscode-json-language-server', '--stdio' }, }))