neodev.nvim
neodev.nvim copied to clipboard
bug: Change to use nightly types causes missing types for vim.uv.*
Did you check docs and existing issues?
- [X] I have read all the neodev.nvim docs
- [X] I have searched the existing issues of neodev.nvim
- [X] I have searched the existing issues of plugins related to this issue
Neovim version (nvim -v)
v0.10.0-dev-2483+g6ab0876f5-Homebrew
Operating system/version
macOS 14.3.1
Describe the bug
The change in b354c3810f8f3a954f9d5ef8c1706451a27a4964 for https://github.com/folke/neodev.nvim/issues/175 (which is great BTW) causes warnings from lua_ls due to the fact that there are no types / functions / members exposed for libuv via vim.uv.* from the Neovim source:
The correct thing to do here is to expose those from Neovim, but I'm wondering if A) there's a shorter term fix you can make here, or B) You happen to have a PR for Neovim already in progress that I'm not aware of. I did search open PRs and issues over there though and didn't see anything.
Steps To Reproduce
Use any vim.uv.* method with lua_ls diagnostics turned on.
Expected Behavior
Member fields and types are properly accounted for.
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/neodev.nvim",
-- add any other plugins here
}
require("lazy").setup(plugins, {
root = root .. "/plugins",
})
vim.cmd.colorscheme("tokyonight")
-- add anything else here
if vim.us.fs_access("init.lua", "R") then
vim.notify("Foo")
end
Until https://github.com/neovim/neovim/issues/26268 is done, neodev could include the meta annotation file into the LuaLs library.
I did a stopgap measure to solve this.
require("lspconfig").lua_ls.setup {
settings = {
Lua = {
workspace = {
library = { require("neodev.config").types() },
},
},
},
}