Skip to content

Commit e9ece8e

Browse files
committed
refactor(snippet): rename AutoDevRunDevInsAction to AutoDevRunAction #257
- Rename class and file to AutoDevRunAction for consistency. - Update XML configuration to reflect the new class name. - Add AutoDevNotifications import and notify on success. - Remove scratch file deletion logic. - Update build.gradle.kts to include Python plugin. - Rename ShirePythonRunService to PythonRunService.
1 parent f454226 commit e9ece8e

File tree

4 files changed

+11
-8
lines changed

4 files changed

+11
-8
lines changed

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ val ideaPlugins =
5252
"org.jetbrains.idea.maven",
5353
"org.jetbrains.kotlin",
5454
"JavaScript"
55-
)
55+
) + prop("pythonPlugin")
5656

5757
var baseIDE = prop("baseIDE")
5858
val platformVersion = prop("platformVersion").toInt()

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@
331331
class="cc.unitmesh.devti.gui.snippet.AutoDevInsertCodeAction"/>
332332
<action id="AutoDev.ToolWindow.Snippet.RunDevIns"
333333
icon="AllIcons.Actions.Execute"
334-
class="cc.unitmesh.devti.gui.snippet.AutoDevRunDevInsAction"/>
334+
class="cc.unitmesh.devti.gui.snippet.AutoDevRunAction"/>
335335
</group>
336336

337337
<group id="AutoDev.ToolWindow.Chat.TitleActions">

core/src/main/kotlin/cc/unitmesh/devti/gui/snippet/AutoDevRunDevInsAction.kt renamed to core/src/main/kotlin/cc/unitmesh/devti/gui/snippet/AutoDevRunAction.kt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package cc.unitmesh.devti.gui.snippet
22

3+
import cc.unitmesh.devti.AutoDevNotifications
34
import com.intellij.ide.scratch.ScratchRootType
45
import com.intellij.openapi.actionSystem.ActionUpdateThread
56
import com.intellij.openapi.actionSystem.AnActionEvent
@@ -9,13 +10,14 @@ import com.intellij.openapi.project.DumbAwareAction
910
import com.intellij.openapi.vfs.readText
1011
import com.intellij.psi.PsiManager
1112
import cc.unitmesh.devti.provider.RunService
13+
import com.intellij.openapi.actionSystem.PlatformDataKeys
1214

13-
class AutoDevRunDevInsAction : DumbAwareAction() {
15+
class AutoDevRunAction : DumbAwareAction() {
1416
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
1517

1618
override fun update(e: AnActionEvent) {
1719
val project = e.project ?: return
18-
val editor = e.getData(com.intellij.openapi.actionSystem.PlatformDataKeys.EDITOR) ?: return
20+
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
1921
val document = editor.document
2022
val file = FileDocumentManager.getInstance().getFile(document)
2123

@@ -31,7 +33,7 @@ class AutoDevRunDevInsAction : DumbAwareAction() {
3133
}
3234

3335
override fun actionPerformed(e: AnActionEvent) {
34-
val editor = e.getData(com.intellij.openapi.actionSystem.PlatformDataKeys.EDITOR) ?: return
36+
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
3537
val project = e.project ?: return
3638

3739
val document = editor.document
@@ -50,9 +52,10 @@ class AutoDevRunDevInsAction : DumbAwareAction() {
5052
psiFile,
5153
)
5254
} finally {
53-
runWriteAction {
54-
scratchFile.delete(this)
55-
}
55+
AutoDevNotifications.notify(project, "Run Success")
56+
// runWriteAction {
57+
// scratchFile.delete(this)
58+
// }
5659
}
5760
}
5861
}

0 commit comments

Comments
 (0)