BaseGenerateAction/CodeInsightAction (Alt+Insert) VS IntentionAction (Alt+Enter)

Answered

I added an action to the generate menu (Alt+Insert) and an intention (yellow light bulb, Alt+Enter), both do exactly the same thing -- generate some new inner class based on the criterias of the outer class -- and both work great.

But is there a good way to tell Intellij that both are "the same" thing, or make an intention to appear in the Generate (Alt+Insert) list or vice versa make an action to appear in the Intentions list (Alt+Enter)? Currently when I search for all actions (Ctrl+Shift+A), both of them show up, so the same thing listed twice :( Their `isValidFor...`/isAvaliable methods are most likely called independently and so redu the same work :(

Or is it a bad idea altogether to try to have both? How would you choose which "UI" element to use for generating code? I like that generating some new code would go under generate menu next to other generate stuff, but i like how intentions have documentation/example page in the settings?

Is one more of way forward than the other from the JetBrain's vision? Would one ever merge into other one in some future API...?

1 comment
Comment actions Permalink

In this case of generating completely new code inside the currently opened class, it would make sense to include it into "Generate" popup only. Intentions are usually rather used to modify existing code.

0

Please sign in to leave a comment.