Skip to content
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

feature: Prevent cleaning dependencies of a plugin marked as conditional #1053

Closed
1 task done
abeldekat opened this issue Sep 28, 2023 · 1 comment · Fixed by #1058
Closed
1 task done

feature: Prevent cleaning dependencies of a plugin marked as conditional #1053

abeldekat opened this issue Sep 28, 2023 · 1 comment · Fixed by #1058
Labels
enhancement New feature or request

Comments

@abeldekat
Copy link
Contributor

Did you check the docs?

  • I have read all the lazy.nvim docs

Is your feature request related to a problem? Please describe.

Example:

  {
    "gbprod/substitute.nvim",
    cond = false,
    event = "VeryLazy",
    dependencies = "tpope/vim-abolish"
  }

In lazy's UI, substitute.nvim is shown in the disabled section, using a different color.
Plugin vim-abolish is only used inside the spec of substitute.nvim.
However, vim-abolish is "just" disabled, and is shown in the clean section of the UI.

Describe the solution you'd like

When plugin A is marked as conditional, and plugin B is only used inside the dependencies of plugin A, plugin B should also be marked as conditional. This prevents plugin B from being cleaned.

Related: bug: plugins not loaded due to cond are not contained in the lazy-lock.json file
Perhaps it would make sense to not remove conditional plugins from lazy-lock.json.

Describe alternatives you've considered

...

Additional context

Folke, if you are interested in this proposal, I could write a PR or extend feat(core): If a plugin is not enabled, ignore all specs in its dependencies

@abeldekat abeldekat added the enhancement New feature or request label Sep 28, 2023
folke added a commit that referenced this issue Sep 29, 2023
…onal plugins (#1058)

* feat(plugin): dont include plugin spec fragments for disabled or optional plugins

* test: fixed tests

* fix(plugin): calculate handlers after disabling plugins

* fix(plugin): clear Plugin._.super when rebuilding

* fix(ui): dont process handlers for disabled plugins

* test: added tests for disabling fragments

* fix(plugin): ignore any installed deps of a disabled conditional plugin. Fixes #1053
@miki725
Copy link

miki725 commented Nov 15, 2023

is there anything you need to do not to clean disabled plugins from lock file? when I do :Lazy restore it removes all disabled plugins from the lock file. By disabled I mean things like:

{
  "plugin",
  cond = function()
     return false
  end
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants