Skip to content

Commit a4e751c

Browse files
committed
fix(snippet): fix UpdateThread issu && add logging to AutoDevInsertCodeAction #51
Add logging to the AutoDevInsertCodeAction class to provide better visibility of actions performed by the code snippet. This will help in debugging and tracking the execution flow.
1 parent e661651 commit a4e751c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/kotlin/cc/unitmesh/devti/gui/snippet/AutoDevInsertCodeAction.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ package cc.unitmesh.devti.gui.snippet
33
import com.intellij.openapi.actionSystem.ActionUpdateThread
44
import com.intellij.openapi.actionSystem.AnActionEvent
55
import com.intellij.openapi.actionSystem.PlatformDataKeys
6+
import com.intellij.openapi.application.runReadAction
67
import com.intellij.openapi.command.WriteCommandAction
8+
import com.intellij.openapi.diagnostic.logger
79
import com.intellij.openapi.fileEditor.FileEditorManager
810
import com.intellij.openapi.project.DumbAwareAction
911
import com.intellij.psi.PsiDocumentManager
1012
import com.intellij.psi.codeStyle.CodeStyleManager
1113

1214

1315
class AutoDevInsertCodeAction : DumbAwareAction() {
16+
private val logger = logger<AutoDevInsertCodeAction>()
17+
1418
override fun actionPerformed(e: AnActionEvent) {
1519
val project = e.project ?: return
1620
val editor = e.getData(PlatformDataKeys.EDITOR) ?: return
@@ -53,5 +57,5 @@ class AutoDevInsertCodeAction : DumbAwareAction() {
5357
}
5458
}
5559

56-
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.BGT
60+
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
5761
}

0 commit comments

Comments
 (0)