luaneovimlanguage-server-protocol

How to include/configure lua_ls on lspconfig?


I am trying to include lua_ls on my lspconfig but I am getting this error [lspconfig] Cannot access configuration for lua_ls. Ensure this server is listed in `server_configurations.md` or added as a custom server.

It will only appear after I add lua_ls to ensured_installed on mason-lspconfig.

I`m using mason and lazy.nvim for plugin manager.

Here is my mason-lspconfig setup

{
        "williamboman/mason-lspconfig.nvim",
        config = function()
            require("mason-lspconfig").setup({
                ensure_installed = {
                    "angularls",
                    "bashls",
                    "cssls",
                    "eslint",
                    "gopls",
                    "html",
                    "jsonls",
                    "lua_ls",
                    "rust_analyzer",
                    "svelte",
                    "tailwindcss",
                    "tsserver",
                    "yamlls",
                },
            })
        end,
    },

Solution

  • The problem was my lazy.nvim config, removing the defaults.version="*" config of lazy.nvim fix the issue, because it was installing the stable version of lspconfig that is not compitable with the latest mason-lspconfig.