Replies: 3 comments 1 reply
-
Looks good! Would be great if you could submit a PR! |
Beta Was this translation helpful? Give feedback.
-
Thanks! I submitted the PR. |
Beta Was this translation helpful? Give feedback.
-
Would it make sense to do something similar with dependencies in general? Like if I have a plugin that what it is added needs to turn on some options for another plugin. For example adding a telescope module plugin that enables it in the telescope |
Beta Was this translation helpful? Give feedback.
-
Currently, when a plugin is marked with "enabled = false", lazy.nvim investigates the dependencies of that plugin,and disables them when appropriate.
Such behaviour is not implemented for a plugin marked with "optional = true".
Any feedback and discussion about the topic is much appreciated as I would like to create a pull request:
My Implementation
Example
Consider a stock LazyVim installation with "extras/lang/python" added to "config/lazy.lua"
The resulting installation includes nvim-dap-python and its keys, but without nvim-dap installed.
Pressing
<leader> d P c
leads to an error.The UI of which-key shows "prefix" as description for "d".
The cause
In "extras/lang/python", nvim-dap-python is a dependency of nvim-dap.
When "extras/dap/core" is not added to "config/lazy.lua", nvim-dap becomes completely optional and will not be installed.
Currently, the dependency of nvim-dap, nvim-dap-python, does get installed.
Note: This pattern applies to multiple configs in extras.
Is it a problem?
If the user wants to use "extras/lang/python" without "extras/dap/core", the following options are available:
The plugin will never load, unless the aforementioned keys are pressed, resulting in an error.
The user now needs to include both python configs for complete functionality.
Implementation
This is relatively straightforward, reusing the existing algorithm doing the disabling of explicitly disabled plugins.
References
Beta Was this translation helpful? Give feedback.
All reactions