You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have read the appropriate plugin's documentation.
I have searched that this issue has not been reported before.
I have ran :checkhealth and so no obvious issue.
By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.
Describe the bug
vim.tbl_extend is used to append the two ${3rd} paths to the lua_ls
workspace library, but both arguments are list tables. vim.tbl_extend
merges by key, so ${3rd}/luv/library and ${3rd}/busted/library land on
indices 1 and 2 and overwrite the first two runtime directories instead
of being appended.
The list never grows: it comes back the same length it went in, minus the two
runtime paths that were silently replaced. On my machine those two are ~/.config/nvim and ~/.local/share/nvim/site.
vim.list_extend is the one that appends.
Why this may be load-bearing, and why the obvious fix is a regression
The two entries that get overwritten are the first two of nvim_get_runtime_file('', true), and the first is the user's own config
directory. That is exactly what the linked nvim-lspconfig#3189 —
referenced in the comment two lines above this one — says to remove, because
including the config dir in workspace.library produces spurious duplicate-doc-field warnings when editing your own config.
So the bug currently implements that issue's workaround by accident. Changing tbl_extend to list_extend on its own will reintroduce the duplicate-doc-field warnings #3189 describes. That seemed worth flagging
before someone applies the one-word fix.
B. Drop the sweep. The comment above already concedes this path "is a lot
slower and will cause issues when working on your own configuration." lazydev.nvim resolves libraries from
the require statements actually present in the buffer. On my config that took
LuaLS from 32 runtime directories (3,331 files, ~650k lines) down to 7 resolved
paths, and the pause on first opening a Lua file went away. This is what LazyVim
does. I understand kickstart may not want the extra dependency — mentioning it
because the trade-off is already acknowledged in the comment.
C. Minimal. Just list_extend, accepting the #3189 warnings come back.
Happy to send a PR for whichever direction you prefer.
client.config.settings.Lua or {} silences the same diagnostic without
depending on nvim-lspconfig's type definitions resolving in the workspace, and
also guards tbl_deep_extend against a nil first argument. Not a bug today
since settings is defined a few lines below with a Lua key — just noting it
since the cast is the only thing making those type definitions load-bearing.
Before Reporting an Issue
I have read the kickstart.nvim README.md.
I have read the appropriate plugin's documentation.
I have searched that this issue has not been reported before.
I have ran
:checkhealthand so no obvious issue.By checking this, I confirm that the above steps are completed. I understand leaving this unchecked will result in this report being closed immediately.
Describe the bug
vim.tbl_extendis used to append the two${3rd}paths to thelua_lsworkspace library, but both arguments are list tables.
vim.tbl_extendmerges by key, so
${3rd}/luv/libraryand${3rd}/busted/libraryland onindices
1and2and overwrite the first two runtime directories insteadof being appended.
init.lua:728 (current master, b01d052):
The list never grows: it comes back the same length it went in, minus the two
runtime paths that were silently replaced. On my machine those two are
~/.config/nvimand~/.local/share/nvim/site.vim.list_extendis the one that appends.Why this may be load-bearing, and why the obvious fix is a regression
The two entries that get overwritten are the first two of
nvim_get_runtime_file('', true), and the first is the user's own configdirectory. That is exactly what the linked
nvim-lspconfig#3189 —
referenced in the comment two lines above this one — says to remove, because
including the config dir in
workspace.libraryproduces spuriousduplicate-doc-fieldwarnings when editing your own config.So the bug currently implements that issue's workaround by accident. Changing
tbl_extendtolist_extendon its own will reintroduce theduplicate-doc-fieldwarnings #3189 describes. That seemed worth flaggingbefore someone applies the one-word fix.
To Reproduce
repro.lua:nvim --headless --clean -c 'luafile repro.lua' -c qaOutput (
--clean, so only 5 runtime dirs; a real config has many more):Potential fixes
Depending on what the intended behaviour is:
A. Append, and filter the config dir explicitly — fixes the merge and keeps
#3189 handled deliberately rather than accidentally:
B. Drop the sweep. The comment above already concedes this path "is a lot
slower and will cause issues when working on your own configuration."
lazydev.nvim resolves libraries from
the
requirestatements actually present in the buffer. On my config that tookLuaLS from 32 runtime directories (3,331 files, ~650k lines) down to 7 resolved
paths, and the pause on first opening a Lua file went away. This is what LazyVim
does. I understand kickstart may not want the extra dependency — mentioning it
because the trade-off is already acknowledged in the comment.
C. Minimal. Just
list_extend, accepting the #3189 warnings come back.Happy to send a PR for whichever direction you prefer.
Unrelated, but adjacent — b01d052
The fix for #2133 kept the
--[[@as lspconfig.settings.lua_ls]]cast butdropped the
or {}the reporter had suggested:client.config.settings.Lua or {}silences the same diagnostic withoutdepending on nvim-lspconfig's type definitions resolving in the workspace, and
also guards
tbl_deep_extendagainst anilfirst argument. Not a bug todaysince
settingsis defined a few lines below with aLuakey — just noting itsince the cast is the only thing making those type definitions load-bearing.
Desktop
Neovim Version