Some questions about configuration of LSPs #57
-
I am considering that migration from nvim-lsp-installer, and I still have some questions about this plugin. Does And I noticed that there is a default handler when LSP is configured. How could I pass a user-defined configuration of a LSP server to nvim-lspconfig by lua table? I think create handler for each server is not convenient. another point is, the package name in registry, for example, I want to install
I think it would be confused if the package name(for LSP only) is different with nvim-lspconfig or nvim-lsp-installer... |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello!
For servers installed outside of mason (e.g. system package manager) you should just directly interact with lspconfig as mason is not involved in that at all.
I need to write docs on what these things do - so this function is not called by mason itself, it's an opt-in functionality for people who prefer to use mason as the main control interface to set up servers, for example: local lspconfig = require("lspconfig")
require("mason-lspconfig").setup_handlers {
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
function (server_name)
lspconfig[server.name].setup {}
end,
-- You can also override the default handler for specific servers by providing them as keys, like so:
["rust_analyzer"] = function ()
require("rust-tools").setup {}
end
}
I understand, however, lspconfig is an optional plugin that comes with a set of unsupported, best-effort, server configurations. You can use Neovim's builtin LSP client perfectly fine without |
Beta Was this translation helpful? Give feedback.
Hello!
mason-lspconfig
is not explicitly responsible for setting up servers, it only registers hooks withlspconfig
as well as provide some other APIs that makes it a bit more seamless - for example an:LspInstall
command, and an API that allow you to "automatically" set up the servers installed via mason so you don't have to do so explicitly for each server in your config.For servers installed outside of mason (e.g. system package manager) you should just directly interact with lspconfig as mason is not involved in that at all.