-
Notifications
You must be signed in to change notification settings - Fork 431
bug: children specs
are not properly ignored when disabling a plugin
#1889
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This isn't stale and is still a problem |
Testing this locally if we change this line lazy.nvim/lua/lazy/core/fragments.lua Line 166 in ac21a63
if plugin.specs and plugin.enabled ~= false then seems to be working (at least with the minimal repro that OP mentioned, plenary is not disabled when lazydev is disabled and when lazydev is enabled then plenary is disabled). Not confident to submit a PR though. |
that would work in this case, but is not the solution, since the parent spec might be enabled elsewhere. |
@folke this doesn't appear to fix the problem. Here is a 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 a random plugin as an example
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{
"karb94/neoscroll.nvim", -- add some random plugin
enabled = false, -- disable plugin, so all child specs should be ignored
specs = {
-- disable plenary if plugin is enabled
{ "nvim-lua/plenary.nvim", enabled = false },
},
},
},
} Could you please reopen this issue? |
I get this, although I do think this is probably because What led me to this is that I'm still encountering this issue in some cases in my personal configuration which I know is using the latest code on |
🤖 I have created a release *beep* *boop* --- ## [11.17.0](v11.16.2...v11.17.0) (2025-02-24) ### Features * **config,render:** allow customizing the debug icon ([#1863](#1863)) ([a9c660d](a9c660d)) * **util:** pass lang to `vim.notify` so that snacks notifier can render the ft. Closes [#1919](#1919) ([c6a57a3](c6a57a3)) ### Bug Fixes * **config:** add missing space on the default debug icon ([#1879](#1879)) ([4df5c4d](4df5c4d)) * **meta:** disable top-level specs before the rest. Closes [#1889](#1889) ([f81a3fb](f81a3fb)) * **ui:** do not show virt_lines for messages ([#1904](#1904)) ([f15a939](f15a939)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
My bad, just made a new release |
Yeah, looks like that does resolve the issue with the |
Ah I found something. 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 a random plugin as an example
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{
"karb94/neoscroll.nvim", -- add some random plugin
specs = {
-- disable plenary if neoscroll is enabled
{ "nvim-lua/plenary.nvim", enabled = false },
},
},
},
{ "karb94/neoscroll.nvim", enabled = false },
} This isn't the exact type of situation. But this is an example of some incorrect behavior. Consider the idea of something living in the LazyVim extras that has some children specs. If someone is using that extra in their configuration and maybe disable a plugin in their configuration it is not disabling the children specs defined in that extra. This could come up if someone has an extra and is conditionally disabling plugins. This results in the |
your example is not correct. it should be under |
ah yeah ignore me 😅 I will report back once I get something figured out. Sorry for the noise right now! |
Okay, I was able to break down the situation in my configuration: 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 a random plugin as an example
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
{
"karb94/neoscroll.nvim", -- add some random plugin
enabled = false,
specs = {
{
"MunifTanjim/nui.nvim",
optional = true, -- only consider if nui is installed elsewhere
specs = {
{ -- only configure some neoscroll option if Nui is installed
-- useful for enabling integrations or whatever with optional plugins
-- if we get to this point then neoscroll is enabled, so optional isn't necessary
"karb94/neoscroll.nvim",
opts = {
hide_cursor = false,
},
},
},
},
-- disable plenary if neoscroll is enabled
{ "nvim-lua/plenary.nvim", enabled = false },
},
},
},
} here is one I'm confident is incorrect this time 😅 I really hope this is helpful haha |
It seems to have to do with the fact that { -- only configure some neoscroll option if Nui is installed
-- useful for enabling integrations or whatever with optional plugins
-- if we get to this point then neoscroll is enabled, so optional isn't necessary
"karb94/neoscroll.nvim",
opts = {
hide_cursor = false,
},
}, then plenary doesn't get disabled. |
Yeah exactly! Even though the children specs should be ignored when the plugin is disabled. The result of this has both |
But this doesn't happen if neoscroll isn't defined as a spec in |
Yup! That's what I think is happening as well |
I've just pushed a change where the dirty plugins are rebuilt right after disabling them. |
🤖 I have created a release *beep* *boop* --- ## [11.17.1](v11.17.0...v11.17.1) (2025-02-25) ### Bug Fixes * **bootstrap:** support for older Neovim versions ([1c9ba37](1c9ba37)) * **meta:** rebuild dirty right after disable. See [#1889](#1889) ([d51cf69](d51cf69)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Thanks for the quick fix @folke ! It looks like there may be some sort of race condition or non-determinism. I do see that the issue is resolved some of the time, but if I keep reopening and closing neovim with the same configuration then I get different behavior. Sometimes it correctly keeps plenary and sometimes it will disable it. Here is a recording of me opening and closing showing the different behaviors: https://asciinema.org/a/yilUilf6dfGbMv1hdmgMwqTHn |
Yep, can also confirm the behavior is not consistent. Sometimes it's disabled, some times not. |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This issue isn't stale and is still a problem |
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days. |
This isn't stale |
Did you check docs and existing issues?
Neovim version (nvim -v)
NVIM v0.10.3
Operating system/version
Arch Linux
Describe the bug
When using the
specs
property in a Lazy plugin specification to add non dependency spec modifications it seems that they are always applied even when the parent plugin is disabled. These specifications should be ignored since the plugin that adds them is no longer enabledSteps To Reproduce
nvim -u repro.lua
, start up the minimal configuration:Lazy
, open lazy and see thatplenary.nvim
is disabled even though it shouldn'tExpected Behavior
plenary.nvim
should not be disabled becauselazydev.nvim
is disabled which should invalidate all of the children specs under it.Repro
The text was updated successfully, but these errors were encountered: