ThePrimeagen/init.lua

renamed sumneko_lua -> lua_ls and 'vim' global undefined

mouktardev opened this issue · 3 comments

Error

just finished setting up through the video and reading documentation however Mason.confi gave me this error :
server "sumneko_lua" is not valid entry in ensure installed. makesure to only provid lspconfig server names

Finding

sumneko_lua just deprecated the name and change it to lua_ls

Issue

'vim' global undefined appearing everywhere there is vim in .lua files so is this not working?

lsp.configure('lua-ls', {
    settings = {
        Lua = {
            diagnostics = {
                globals = { 'vim' }
            }
        }
    }
})

I had this same issue and it drove me nuts yesterday!

I changed sumneko_lua to lua-lsp in ensure_installed as well as in lsp.configure

So far seems to work fine for me!

as an example:

lsp.ensure_installed({
  'tsserver',
  'eslint',
  'lua_ls',
  'rust_analyzer',
})

-- Fix Undefined global 'vim'
lsp.configure('lua_ls', {
    settings = {
        Lua = {
            diagnostics = {
                globals = { 'vim' }
            }
        }
    }
})

as an example:

lsp.ensure_installed({
  'tsserver',
  'eslint',
  'lua_ls',
  'rust_analyzer',
})

-- Fix Undefined global 'vim'
lsp.configure('lua_ls', {
    settings = {
        Lua = {
            diagnostics = {
                globals = { 'vim' }
            }
        }
    }
})

thanks that fixed 'vim' global undefined warning