neodev.nvim
neodev.nvim copied to clipboard
bug: Recent attempt to fix the double Lua LSP workspace loading progress seems to break Lua indexes in certain situations
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)
NVIM v0.10.0-dev-2135+g98a4ed0a1
Operating system/version
Windows 11
Describe the bug
Related references / discussion:
- https://github.com/folke/neodev.nvim/commit/c6be05aab078827e51aabdc64cc9fba7c06d27b7#r137665412
- https://github.com/LuaLS/lua-language-server/issues/1596#issuecomment-1905757027
- https://github.com/folke/neodev.nvim/commit/e7ca4a2ea0da5e39a639c08c3edb352b9355f09e
As mentioned here (https://github.com/folke/neodev.nvim/commit/c6be05aab078827e51aabdc64cc9fba7c06d27b7#r137665412)
I have problems using lspsaga peek definitions as it loads the peeked item in a floating window and then loads the lsp for that floating window... it seems to conflict with whatever changes were made in this PR as lua language server then reloads the lua workspace files specific to just that floating window (I think basically just loads the few files related to whatever I am peeking)... so then what happens is when I close the floating window my original file seems to have reference to just those limited lua workspace loaded files and all the sudden I get a bunch of diagnostics for missing references for vim.xxx global definitions. To fix this I have to run a LspRestart on that buffer.
As further context, @liskin workaround posted here (https://github.com/LuaLS/lua-language-server/issues/1596#issuecomment-1855087288) does work as expected and does not have this issue.
Steps To Reproduce
- See below my
.neoconf.json
(main thing to notice is I have disabled importing of all plugins and only have a few imported with my lua workspace. - Add a line to one of your lazy plugin imports for setting a keymap like:
vim.keymap.set("n", "<leader>TEST", "TEST", { desc = "TEST" })
- Restart neovim
- Use LspSaga to do a peek definition on the
keymap
keyword from step 2 using:Lspsaga peek_definition
- Notice in my final screenshot below I (1) peek def keymap (2) loads def from neodev types nightly (3) the diagnostic of undefined globals now pops up in my original buffer
.neoconf.json
{
"neodev": {
"library": {
"enabled": true,
"runtime": true,
"types": true,
"plugins": [
"nvim-treesitter",
"plenary.nvim",
"telescope.nvim"
]
}
},
"neoconf": {
"plugins": {
"lua_ls": {
"enabled": true
}
}
}
}
Expected Behavior
The lua lsp workspace loader should not be duplicated, which is now working as expected... but now when I peek into other buffers, the lua workspace indexing seems to lose references most notably it seems to the core vim api stuff?
Repro
No response
I meet this issue.. the situation is .. everything is ok at first time I open the file. and after I do some operations , the lua_ls is reload double for this buffer. and everything has gone.. lsp is no effective ..
I meet this issue.. 我遇到这个问题.. the situation is .. everything is ok at first time I open the file. and after I do some operations , the lua_ls is reload double for this buffer. and everything has gone.. lsp is no effective ..一切都消失了.. lsp 无效..
it's volar's issue
Is there any known workaround? The plugin is basically useless because of this