aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/pack.lua
diff options
context:
space:
mode:
authorEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2025-10-04 16:13:36 +0300
committerEvgeni Chasnovski <evgeni.chasnovski@gmail.com>2025-10-04 16:13:36 +0300
commit2c0b70e5598d0fd888a524ea955d48b91ceccd29 (patch)
tree7fefa264fc41b50fbf386194024f0edf6d31c98f /runtime/lua/vim/pack.lua
parentd7db552394ead8ad9b365c60a650a425d50c5adf (diff)
downloadrneovim-2c0b70e5598d0fd888a524ea955d48b91ceccd29.tar.gz
rneovim-2c0b70e5598d0fd888a524ea955d48b91ceccd29.tar.bz2
rneovim-2c0b70e5598d0fd888a524ea955d48b91ceccd29.zip
fix(pack)!: use lockfile in `get()` for data about non-active plugins
Problem: `get()` doesn't return `spec.version` about not-yet-active plugins (because there was no way to know that without `add()`). Solution: Use lockfile data to set `spec.version` of non-active plugins.
Diffstat (limited to 'runtime/lua/vim/pack.lua')
-rw-r--r--runtime/lua/vim/pack.lua22
1 files changed, 9 insertions, 13 deletions
diff --git a/runtime/lua/vim/pack.lua b/runtime/lua/vim/pack.lua
index fc889f6780..fb6ff2958f 100644
--- a/runtime/lua/vim/pack.lua
+++ b/runtime/lua/vim/pack.lua
@@ -1122,6 +1122,7 @@ function M.get(names, opts)
active[p_active.id] = p_active.plug
end
+ lock_read()
local res = {} --- @type vim.pack.PlugData[]
local used_names = {} --- @type table<string,boolean>
for i = 1, n_active_plugins do
@@ -1131,21 +1132,16 @@ function M.get(names, opts)
end
end
- --- @async
- local function do_get()
- -- Process not active plugins
- local plug_dir = get_plug_dir()
- for n, t in vim.fs.dir(plug_dir, { depth = 1 }) do
- local path = vim.fs.joinpath(plug_dir, n)
- local is_in_names = not names or vim.tbl_contains(names, n)
- if t == 'directory' and not active_plugins[path] and is_in_names then
- local spec = { name = n, src = git_cmd({ 'remote', 'get-url', 'origin' }, path) }
- res[#res + 1] = { spec = spec, path = path, active = false }
- used_names[n] = true
- end
+ local plug_dir = get_plug_dir()
+ for name, l_data in vim.spairs(plugin_lock.plugins) do
+ local path = vim.fs.joinpath(plug_dir, name)
+ local is_in_names = not names or vim.tbl_contains(names, name)
+ if not active_plugins[path] and is_in_names then
+ local spec = { name = name, src = l_data.src, version = l_data.version }
+ res[#res + 1] = { spec = spec, path = path, active = false }
+ used_names[name] = true
end
end
- async.run(do_get):wait()
if names ~= nil then
-- Align result with input