A small plugin that autoconfigures LSPs that are found on your $PATH
.
The excellent Mason, allows for relatively seamless installation and management of LSPs. If you wish to install them more globally on your system so they are available to other apps/tools, then it can be more cumbersome to set up.
This plugin checks for specified (or, alternatively, all known) LSPs on
$PATH
, and configures them for use if found.
By default, it uses LSP Zero for configuration.
Auto-magic:
{
"themissingcow/nvim-auto-lsp",
dependencies = {
"neovim/nvim-lspconfig",
"VonHeikemen/lsp-zero.nvim",
},
config = true
}
If you wish to customize LSP integration:
{
"themissingcow/nvim-auto-lsp",
config = function()
local lsp_zero = require("lsp-zero")
require("nvim-auto-lsp").setup({
-- Provide a specific list of servers (recommended),
-- reduces startup time.
servers = {
"bashls", "zk", "clangd", "ltex", "lua_ls", "pyright",
"dockerls", "cssls", "yamlls", "cmake", "html",
"marksman",
},
-- Customize options for specific servers
server_opts = {
lua_ls = lsp_zero.nvim_lua_ls(),
ltex = {
language = "en-GB",
disabledRules = { ["en-GB"] = { "MORFOLOGIK_RULE_EN_GB" } },
},
},
})
end,
dependencies = {
"VonHeikemen/lsp-zero.nvim",
{
"neovim/nvim-lspconfig",
config = function()
-- Traditional LSP configuration
end)
end,
},
},
}
require("nvim-auto-lsp").setup( {
init_function = function (server, opts)
local lspconfig = require("lspconfig")
local lsp_zero = require("lsp-zero")
lspconfig[server].setup(lsp_zero.build_options(server, opts))
end,
-- servers = {},
server_opts = {
-- server = {}
}
})
Many thanks to William Boman for the work on Mason. and the server mappings.