Configure lspconfig for each lsp server required

This commit is contained in:
2023-03-26 15:00:39 +02:00
parent b881418b33
commit 2c2abb0fc8

View File

@@ -445,18 +445,20 @@ end
-- Add any additional override configuration in the following tables. They will be passed to -- Add any additional override configuration in the following tables. They will be passed to
-- the `settings` field of the server config. You must look up that documentation yourself. -- the `settings` field of the server config. You must look up that documentation yourself.
local servers = { local servers = {
-- clangd = {}, clangd = {},
-- gopls = {}, cssls = {},
-- pyright = {}, eslint = {},
-- rust_analyzer = {}, jsonls = {},
-- tsserver = {}, golangci_lint_ls = {},
gopls = {},
-- sumneko_lua = { lua_ls = {},
-- Lua = { pyright = {},
-- workspace = { checkThirdParty = false }, pylsp = {},
-- telemetry = { enable = false }, rust_analyzer = {},
-- }, svelte = {},
-- }, tsserver = {},
vimls = {},
volar = {},
} }
-- Setup neovim lua configuration -- Setup neovim lua configuration
@@ -469,8 +471,20 @@ capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
-- Setup mason so it can manage external tooling -- Setup mason so it can manage external tooling
require("mason").setup() require("mason").setup()
require("mason-lspconfig").setup { -- Configure lspconfig for each server
ensure_installed = { "cssls", "eslint", "jsonls", "lua_ls", "pylsp", "rust_analyzer", "svelte", "tsserver", "vimls", "volar" }, local mason_lspconfig = require 'mason-lspconfig'
mason_lspconfig.setup {
ensure_installed = vim.tbl_keys(servers),
}
mason_lspconfig.setup_handlers {
function(server_name)
require('lspconfig')[server_name].setup {
capabilities = capabilities,
on_attach = on_attach,
settings = servers[server_name],
}
end,
} }
-- Turn on lsp status information -- Turn on lsp status information