0

I'm trying to set up autocompletion, fixing, etc. for lua files in Neovim. I started by trying to follow the instructions from this video: https://www.youtube.com/watch?v=lpQMeFph1RE&t=188s

However, I quickly found out that sumneko_lua no longer exists so I replaced it with lua_ls. Here is my lazy config:

{'williamboman/mason.nvim', config = function() require("mason").setup() end},
{
    'williamboman/mason-lspconfig.nvim',
    config = function() 
        require("mason-lspconfig").setup({ensure_installed = {'lua_ls'}})
    end,
    dependencies = {'williamboman/mason.nvim'}},
{
    'neovim/nvim-lspconfig',
    dependencies = {'williamboman/mason-lspconfig.nvim', 'williamboman/mason.nvim'},
    config = function() 
        require('lspconfig').lua_ls.setup({})
    end
}

However, when I launch Neovim I see the following error:

Failed to run config for nvim-lspconfig
...share/nvim/lazy/nvim-lspconfig/lua/lspconfig/configs.lua:10: attempt to index local 'config_def' (a boolean value)

I'm confused by this error, since I am not calling anything by the name of config_def. What am I doing wrong here?

1
  • Could be a bug in the plugin
    – D. Ben Knoble
    Commented Oct 1, 2023 at 18:15

1 Answer 1

0

For some reason, the name of lua_ls in lspconfig is still sumneko_lua. So replacing this worked:

{'williamboman/mason.nvim', config = function() require("mason").setup() end},
{
    'williamboman/mason-lspconfig.nvim',
    config = function() 
        require("mason-lspconfig").setup({ensure_installed = {'lua_ls'}})
    end,
    dependencies = {'williamboman/mason.nvim'}},
{
    'neovim/nvim-lspconfig',
    dependencies = {'williamboman/mason-lspconfig.nvim', 'williamboman/mason.nvim'},
    config = function() 
        -- HERE'S THE BIT I HAD TO CHANGE:
        require('lspconfig').sumneko_lua.setup({})
    end
}

My guess is that mason has updated the name to lua_ls but lspconfig hasn't.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.