I am using Neovim with LSP and I am having an issue with saving any of my tsx file. I keep getting prompted to select a language server:
Here is how I am configuring my language servers
lspinstall.setup()
local servers = lspinstall.installed_servers()
for _, lsp in ipairs(servers) do
if lsp == 'tsserver' then
require('lsp.tsserver')
elseif lsp == 'efm' then
require('lsp.efm')
elseif lsp == 'html' then
require('lsp.html')
else
nvim_lsp[lsp].setup {on_attach = on_attach, settings = {Lua = {diagnostics = {globals = {'vim'}}}}}
end
end
If I do :LspInfo
I am seeing the 2 servers seen in the screenshot.
EFM config
local lspconfig = require 'lspconfig'
local prettier = {formatCommand = './node_modules/.bin/prettier --config-precedence prefer-file --stdin-filepath ${INPUT}', formatStdin = true}
local luaFormat = {
formatCommand = 'lua-format -i --no-keep-simple-function-one-line --column-limit=120 --indent-width=2 --double-quote-to-single-quote',
formatStdin = true
}
lspconfig.efm.setup {
-- cmd = {'efm-langserver', '-logfile', '/tmp/efm.log', '-loglevel', '5'},
on_attach = on_attach,
init_options = {documentFormatting = true},
filetypes = {'javascriptreact', 'javascript', 'lua', 'typescriptreact', 'typescript'},
settings = {
rootMarkers = {'.git/'},
languages = {lua = {luaFormat}, typescript = {prettier}, typescriptreact = {prettier}}
}
}
typescript config
local lspconfig = require 'lspconfig'
lspconfig.tsserver.setup {
on_attach = function(client, bufnr)
client.resolved_capabilities.document_formatting = false
on_attach(client, bufnr)
end,
settings = {diagnostics = {globals = {'on_attach'}}}
}
Thanks for any help