1
0
Fork 0

LSP: Fix tsserver

This commit is contained in:
Daniel Kempkens 2021-12-10 00:06:07 +01:00
parent 08049927e0
commit 223f47bad2

View file

@ -35,6 +35,11 @@ local function custom_attach(client, bufnr)
vim.api.nvim_command('doautocmd <nomodeline> User NifocLspAttached') vim.api.nvim_command('doautocmd <nomodeline> User NifocLspAttached')
end end
local function custom_attach_no_format(client, bufnr)
client.resolved_capabilities.document_formatting = false
custom_attach(client, bufnr)
end
-- Setup -- Setup
vim.cmd('sign define LspDiagnosticsSignError text= texthl=LspDiagnosticsSignError linehl= numhl=') vim.cmd('sign define LspDiagnosticsSignError text= texthl=LspDiagnosticsSignError linehl= numhl=')
@ -91,16 +96,11 @@ end
-- Default configuration without formatting -- Default configuration without formatting
local default_servers_no_formatting = { local default_servers_no_formatting = {}
'tsserver'
}
for _, name in ipairs(default_servers_no_formatting) do for _, name in ipairs(default_servers_no_formatting) do
lsp[name].setup(vim.tbl_extend('force', default_config, { lsp[name].setup(vim.tbl_extend('force', default_config, {
on_attach = function(client, bufnr) on_attach = custom_attach_no_format,
client.resolved_capabilities.document_formatting = false
custom_attach(client, bufnr)
end,
})) }))
end end
@ -110,6 +110,11 @@ lsp.elixirls.setup(vim.tbl_extend('force', default_config, {
cmd = { 'elixir-ls' }, 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, { lsp.jsonls.setup(vim.tbl_extend('force', default_config, {
cmd = { 'vscode-json-language-server', '--stdio' }, cmd = { 'vscode-json-language-server', '--stdio' },
})) }))