Skip to content

bug: pkg-cache.lua not updating when uninstalling plugin #2131

@dpetka2001

Description

@dpetka2001

Did you check docs and existing issues?

  • I have read all the lazy.nvim docs
  • I have updated the plugin to the latest version before submitting this issue
  • I have searched the existing issues of lazy.nvim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

v0.12.0-dev-2363+gea3942f222

Operating system/version

Arch Linux

Describe the bug

It seems that the pkg-cache.lua file does not get updated when uninstalling a plugin that also has a rockspec file.

I noticed this in LazyVim by enabling lang.python and dap.core Extras. Afterwards when disabling dap.core Extra nvim-dap and nvim-dap-python don't get uninstalled. I noticed that the pkg-cache.lua file contains an entry

{
			name = "nvim-dap-python",
			file = "nvim-dap-python-scm-1.rockspec",
			source = "rockspec",
			spec = { "nvim-dap-python", build = false, specs = { { "mfussenegger/nvim-dap" } } },
			dir = "/home/jrn23/.local/share/test_configs/test/lazy/nvim-dap-python",
		},

Even if you manually try to uninstall the plugins from Lazy UI, they get re-installed in the next Neovim restart. Unless you manually remove the above entry from pkg-cache.lua file the plugins won't be uninstalled.

Also tested with lang.go and dap.core and in this case, disabling dap.core Extra successfully removes the Go dap adapter. By looking through its repo, I noticed it doesn't have a rockspec file, so maybe this is related?

Steps To Reproduce

Just use LazyVim and enable/disable the aforementioned Extras.

Expected Behavior

All plugins installed by the corresponding Extra should get uninstalled.

Repro

vim.env.LAZY_STDPATH = ".repro"
load(vim.fn.system("curl -s https://raw.githubusercontent.com/folke/lazy.nvim/main/bootstrap.lua"))()

require("lazy.minit").repro({
  spec = {
    -- add any other plugins here
  },
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions