Skip to content

Commit 648de34

Browse files
committed
fix(plugin): add dynamic action group for AutoDev Chat
Refactors the existing hardcoded action groups into a dynamic group as per JetBrains' documentation. This change improves maintainability and flexibility, allowing for easier addition and management of actions within the plugin. The `AutoDevChatGroup` is now a dynamic group, which will simplify future updates and ensure a more consistent user experience across different versions of the IDE.
1 parent eeeb113 commit 648de34

File tree

3 files changed

+17
-11
lines changed

3 files changed

+17
-11
lines changed

java/src/main/resources/cc.unitmesh.idea.xml

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,6 @@
6060
<bundleName>messages.AutoDevBundle</bundleName>
6161
<categoryKey>intention.category.llm</categoryKey>
6262
</autoDevIntention>
63-
64-
<actions>
65-
<group id="org.intellij.sdk.action.GroupedActions" popup="true" text="AutoDev Chat"
66-
description="AutoDev chat">
67-
<action id="cc.unitmesh.idea.actions.GenTestDataAction"
68-
class="cc.unitmesh.idea.actions.GenTestDataAction" text="Generate Test Data (APIs)"
69-
description="Ask AI write this code">
70-
</action>
71-
</group>
72-
</actions>
7363
</extensions>
7464

7565
<extensions defaultExtensionNs="com.intellij">

src/222/main/resources/META-INF/autodev-core.xml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@
194194
</group>
195195

196196
<!-- For right click -->
197-
<group id="org.intellij.sdk.action.GroupedActions" popup="true" text="AutoDev Chat" description="AutoDev chat">
197+
<!-- TODO: refactor to dynamic group: https://plugins.jetbrains.com/docs/intellij/grouping-action.html#adding-child-actions-to-the-dynamic-group -->
198+
<group id="AutoDevChatGroup" popup="true" text="AutoDev Chat" description="AutoDev chat">
198199
<action id="cc.unitmesh.devti.actions.chat.ExplainThisChatAction"
199200
class="cc.unitmesh.devti.actions.chat.ExplainThisChatAction" text="Explain This"
200201
description="Ask AI about this code">
@@ -215,6 +216,13 @@
215216
description="Ask AI write this code">
216217
</action>
217218

219+
<action id="cc.unitmesh.idea.actions.GenTestDataAction"
220+
class="cc.unitmesh.idea.actions.GenTestDataAction" text="Generate Test Data (APIs)"
221+
description="Ask AI generate test data">
222+
223+
<add-to-group group-id="GenerateGroup" anchor="last"/>
224+
</action>
225+
218226
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
219227
</group>
220228

src/233/main/resources/META-INF/autodev-core.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@
195195
</group>
196196

197197
<!-- For right click -->
198+
<!-- TODO: refactor to dynamic group: https://plugins.jetbrains.com/docs/intellij/grouping-action.html#adding-child-actions-to-the-dynamic-group -->
198199
<group id="org.intellij.sdk.action.GroupedActions" popup="true" text="AutoDev Chat" description="AutoDev chat">
199200
<action id="cc.unitmesh.devti.actions.chat.ExplainThisAction"
200201
class="cc.unitmesh.devti.actions.chat.ExplainThisAction" text="Explain This"
@@ -216,6 +217,13 @@
216217
description="Ask AI write this code">
217218
</action>
218219

220+
<action id="cc.unitmesh.idea.actions.GenTestDataAction"
221+
class="cc.unitmesh.idea.actions.GenTestDataAction" text="Generate Test Data (APIs)"
222+
description="Ask AI generate test data">
223+
224+
<add-to-group group-id="GenerateGroup" anchor="last"/>
225+
</action>
226+
219227
<add-to-group group-id="EditorPopupMenu" anchor="first"/>
220228
</group>
221229

0 commit comments

Comments
 (0)