Skip to content

Configure lua_ls LSP settings for Neovim Lua development #12

Description

@user3301

Problem

lua_ls is registered in lsp.lua but has no settings configured. This causes false undefined-global warnings for vim and LazyVim globals in Neovim config files.

Solution

Add proper lua_ls settings to nvim/.config/nvim/lua/plugins/lsp.lua:

lua_ls = {
  mason = not is_nixos,
  settings = {
    Lua = {
      runtime = { version = "LuaJIT" },
      workspace = {
        checkThirdParty = false,
        library = vim.api.nvim_get_runtime_file("", true),
      },
      diagnostics = {
        globals = { "vim", "LazyVim" },
      },
      telemetry = { enable = false },
    },
  },
},

Expected Result

  • No more undefined-global warnings for vim and LazyVim
  • Proper Neovim API completions and type checking in Lua config files

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions