OptOut plugin dependency

Answered

I know it is possible to enable (part of) my plugin when another plugin is present using the dependency part of the plugin.xml. Is it also possible to enable part of my plugin only when another plugin is NOT installed.

Use-case:

MyPlugin and DependantPlugin both provide support for LanguageFoo. Since LanguageFoo support is only a small part of MyPlugin I would like to provide the option to the users to use DependantPlugin for LanguageFoo but not force them to use it. When DependantPlugin is available I would like MyPlugin to disable support for LanguageFoo and give way to DependantPlugin.

Something that would look like:

<depends optional="true" 
config-file-when-not-available="xmlThatAddsLanguageFooSupportDevelopedByMyPlugin.xml"
config-file-when-available="xmlThatExtendsOnDependantPlugin.xml">DependantPlugin</depends>
2 comments
Comment actions Permalink

This is currently not possible, at least not declaratively via plugin.xml. You could possibly disable some parts of your plugin's functionality programmatically by checking installed plugins for known "competition" plugins, see https://plugins.jetbrains.com/docs/intellij/ide-infrastructure.html#plugin-management. Though disabling the whole Language support will be tricky to implement correctly and reliable (e.g. react to dynamic installation of other plugin), and probably involve using some internal/impl API.

0
Comment actions Permalink

Thanks for your quick reply Yann. I think I'll go for splitting up the plugin (MyPlugin and MyFooLanguagePlugin) which makes it a bit cleaner anyway. Then MyPlugin can have 2 distinct depends declarations, one for the split of part and one for the "competition" plugin

0

Please sign in to leave a comment.