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

Recommended configuration for lua_ls causes issues #3189

Open
jecaro opened this issue Jun 2, 2024 · 0 comments
Open

Recommended configuration for lua_ls causes issues #3189

jecaro opened this issue Jun 2, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@jecaro
Copy link

jecaro commented Jun 2, 2024

Description

One of the options recommended for lua_ls causes issues when working on one own neovim configuration.

-- or pull in all of 'runtimepath'. NOTE: this is a lot slower
-- library = vim.api.nvim_get_runtime_file("", true)

The problem is that nvim_get_runtime_file returns all neovim runtime directories, including the user config itself. Then when working on one own neovim config, lua_ls sees it kind of twice and outputs a lot of wrong duplicated fields warnings ([duplicate-doc-field]). I suspect this is this issue.

Removing those two directories from the runtime path, makes the issue disappear:

-- lua language server is super confused when editing lua files in the config
-- and raises a lot of [duplicate-doc-field] warnings
local runtime_files = vim.api.nvim_get_runtime_file("", true)
for k, v in ipairs(runtime_files) do
  if v == "/home/my-login/.config/nvim/after" or v == "/home/my-login/.config/nvim" then
    table.remove(runtime_files, k)
  end
end

...

-- library = vim.api.nvim_get_runtime_file("", true) 
library = runtime_files
@jecaro jecaro added the bug Something isn't working label Jun 2, 2024
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

No branches or pull requests

1 participant