-
Hello, I tried going from lsp-installer to mason for my LSP servers installation but I am hiting a wall when I try to configure the servers. The installation part is working fine. Here is how I am trying to do it unsuccessfully: local status_ok, mason_lspconfig = pcall(require, "mason-lspconfig")
if not status_ok then
vim.notify("Couldn't load Mason-LSP-Config" .. mason_lspconfig, "error")
return
end
mason_lspconfig.setup({
ensure_installed = { "ansible-language-server", "clangd", "cmake-language-servere", "css-lsp", "html-lsp", "json-lsp",
"lemminx", "lua-language-server", "pyright", "rust_analyzer", "ltex-ls", "taplo", "terraform-ls",
"vim-language-server", "yaml-language-server" },
})
mason_lspconfig.setup_handlers({
function(server_name) -- Default handler (optional)
require("lspconfig")[server_name].setup {
on_attach = require("plugins.lsp.lsp-config").on_attach,
capabilities = require("plugins.lsp.lsp-config").capabilities,
}
end,
["lua-language-server"] = function()
return {
on_attach = require("plugins.lsp.lsp-config").on_attach,
capabilities = require("plugins.lsp.lsp-config").capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
},
},
},
}
end,
}) The key word |
Beta Was this translation helpful? Give feedback.
Answered by
Orlinky
Jul 17, 2022
Replies: 1 comment 2 replies
-
After taking a break and reading this question I found my answer: ["sumneko_lua"] = function()
require("lspconfig").sumneko_lua.setup({
on_attach = opts.on_attach,
capabilities = opts.capabilities,
settings = {
Lua = {
diagnostics = {
globals = { "vim" },
},
workspace = {
library = {
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
[vim.fn.stdpath("config") .. "/lua"] = true,
},
},
},
},
}) |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
Orlinky
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
After taking a break and reading this question I found my answer: