Intention action: how to create a submenu with custom actions?
Answered
Hi,
I'm trying to add an intention action with a submenu where the user can choose a proper option based on their context. As I can see for the Kotlin some actions has a submenu with "fix all" / "suppress" options.
Is there any way to create an action with custom submenu options list?
Please sign in to leave a comment.
Hi,
See
com.intellij.codeInsight.intention.IntentionActionWithOptions.Are you sure it works in the context of quick fixes added to the annotation builder?
I tried to use `IntentionActionWithOptions`, but it didn't work for me.
I didn't implement this API, but looking at its docs, it should work with quick fixes.
Please share what you tried to do.
Sure, I created an action that extends "IntentionActionWithOptions" and passed an instance when setting a fix to the annotation builder
Unfortunately, while the action appeared in the IDE, the options are not shown when the action is selected.
Karol Lewandowski or you need a more detailed example?
It seems to be available for third-party plugins since 2023.1.
You also have to implement:
Thanks, I see how it can be implemented for the annotation builder now.
But looks like it does not work for "<intentionAction>" declared in the plugins.xml. Can you suggest any solution here?