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

bug: Undefined field lua_ls #62

Open
3 tasks done
heygarrett opened this issue Jun 13, 2024 · 1 comment
Open
3 tasks done

bug: Undefined field lua_ls #62

heygarrett opened this issue Jun 13, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@heygarrett
Copy link

heygarrett commented Jun 13, 2024

Did you check docs and existing issues?

  • I have read all the neoconf.nvim docs
  • I have searched the existing issues of neoconf.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1716656478
Run "nvim -V1 -v" for more info

Operating system/version

macOS 14.5 (23F79)

Describe the bug

When using nvim-lspconfig to configure a language server, the language server name has an Undefined field warning (eg, in require("lspconfig").lua_ls.setup({}), lua_ls has warning "Undefined field lua_ls"). This happens with every language server I have configured.

Steps To Reproduce

  1. Have lua-language-server installed
  2. Use the included repro.lua to open the repro.lua in Neovim

Expected Behavior

The lua_ls in require("lspconfig").lua_ls.setup({}) will not have an Undefined field warning.

Repro

-- DO NOT change the paths and don't remove the colorscheme
local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
	vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
	vim.fn.system({
		"git",
		"clone",
		"--filter=blob:none",
		"https://github.com/folke/lazy.nvim.git",
		lazypath,
	})
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
	"folke/tokyonight.nvim",
	"folke/neoconf.nvim",
	-- add any other plugins here
	{
		"https://github.com/neovim/nvim-lspconfig",
		config = function()
			require("neoconf").setup({})
			require("lspconfig").lua_ls.setup({})
		end,
	},
}
require("lazy").setup(plugins, {
	root = root .. "/plugins",
})

vim.cmd.colorscheme("tokyonight")
-- add anything else here
@heygarrett heygarrett added the bug Something isn't working label Jun 13, 2024
@heygarrett
Copy link
Author

TIL nvim-lspconfig uses a metatable to set up the server configs:
https://github.com/neovim/nvim-lspconfig/blob/bd7c76375a511994c9ca8d69441f134dc10ae3bd/lua/lspconfig.lua#L36

So it looks like neoconf may just be revealing that they're not actually properties in the lspconfig table. Does that make this issue irrelevant? Let me know; I'm happy to close it.

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