Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete documentation for lua_ls #2951

Closed
aminnairi opened this issue Dec 29, 2023 · 3 comments · Fixed by #3029
Closed

Incomplete documentation for lua_ls #2951

aminnairi opened this issue Dec 29, 2023 · 3 comments · Fixed by #3029
Labels
bug Something isn't working

Comments

@aminnairi
Copy link

aminnairi commented Dec 29, 2023

Description

As per the discussion in #2948, it would be great to update the documentation to clearly indicate that the /lua folder needs to be used at the end in order for the Lua language server to pick up documentations for the Vim's Lua runtime.

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

Nvim-lspconfig version

master

Operating system and version

Arch

Affected language servers

lua_ls

Steps to reproduce

  1. Go to the server_configurations.md file.
  2. Search for the documentation for lua_ls.
  3. Notice that the line where vim.env.VIMRUNTIME is described lacks the /lua folder at the end.

Actual behavior

The documentation does not mention concatenating the /lua folder when setting up the lua_ls.

Expected behavior

The documentation should mention concatenating the /lua folder when setting up the lua_ls.

Minimal config

require'lspconfig'.lua_ls.setup {
  on_init = function(client)
    local path = client.workspace_folders[1].name
    if not vim.loop.fs_stat(path..'/.luarc.json') and not vim.loop.fs_stat(path..'/.luarc.jsonc') then
      client.config.settings = vim.tbl_deep_extend('force', client.config.settings, {
        Lua = {
          runtime = {
            -- Tell the language server which version of Lua you're using
            -- (most likely LuaJIT in the case of Neovim)
            version = 'LuaJIT'
          },
          -- Make the server aware of Neovim runtime files
          workspace = {
            checkThirdParty = false,
            library = {
              vim.env.VIMRUNTIME
              -- "${3rd}/luv/library"
              -- "${3rd}/busted/library",
            }
            -- or pull in all of 'runtimepath'. NOTE: this is a lot slower
            -- library = vim.api.nvim_get_runtime_file("", true)
          }
        }
      })

      client.notify("workspace/didChangeConfiguration", { settings = client.config.settings })
    end
    return true
  end
}

LSP log

None.

@aminnairi aminnairi added the bug Something isn't working label Dec 29, 2023
@lithammer
Copy link
Collaborator

I would probably just use https://github.com/folke/neodev.nvim instead.

@justinmk
Copy link
Member

PR welcome?

@MariaSolOs
Copy link
Member

I would probably just use https://github.com/folke/neodev.nvim instead.

Note that since neovim/neovim#24592 there's no need for neodev anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants