Hi all,
I am trying to change the language setting for the ltex-ls
language server.
I’m using the nvim-lspconfig
and nvim-lsp-installer
plugins (having used the latter to install ltex-ls
).
Following these instructions, I did:
local lsp_installer = require("nvim-lsp-installer")
-- Create tables with changed server options if you want to deviate from the
-- default settings
local server_opts = {
-- Provide settings that should only apply to "server-name" server
["ltex-ls"] = function(opts)
opts.settings = {
ltex = {
language = "en-GB"
},
}
end,
}
-- Register a handler that will be called for all installed servers.
-- Alternatively, you may also register handlers on specific server instances instead (see example below).
lsp_installer.on_server_ready(function(server)
-- Cpecify the default options which we'll use to setup all servers
local opts = {
on_attach = on_attach,
}
if server_opts[server.name] then
-- Enhance the default opts with the server-specific ones
server_opts[server.name](opts)
end
-- This setup() function is exactly the same as lspconfig's setup function.
-- Refer to https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md
server:setup(opts)
end)
I’m probably doing something silly, but I’m not sure what!
On that note, would it be possible to add multiple languages to ltex-ls
, or switch the selected language easier than by editing the configs?
Any help would be appreciated! Thanks.