Skip to content

Commit e02b027

Browse files
committed
refactor(compiler): remove unnecessary runReadAction in DirInsCommand #257
The `runReadAction` wrapper was removed as it is redundant for the `listDirectory` call, which is already thread-safe and does not require read action protection.
1 parent 19aac7d commit e02b027

File tree

1 file changed

+2
-1
lines changed
  • exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec

1 file changed

+2
-1
lines changed

exts/devins-lang/src/main/kotlin/cc/unitmesh/devti/language/compiler/exec/DirInsCommand.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package cc.unitmesh.devti.language.compiler.exec
33
import cc.unitmesh.devti.devin.InsCommand
44
import cc.unitmesh.devti.devin.dataprovider.BuiltinCommand
55
import cc.unitmesh.devti.language.utils.lookupFile
6+
import com.intellij.openapi.application.runReadAction
67
import com.intellij.openapi.project.Project
78
import com.intellij.psi.PsiDirectory
89
import com.intellij.psi.PsiManager
@@ -38,7 +39,7 @@ class DirInsCommand(private val myProject: Project, private val dir: String) : I
3839
val psiDirectory = PsiManager.getInstance(myProject).findDirectory(virtualFile) ?: return null
3940

4041
output.appendLine("$dir/")
41-
listDirectory(psiDirectory, 1)
42+
runReadAction { listDirectory(psiDirectory, 1) }
4243

4344
return output.toString()
4445
}

0 commit comments

Comments
 (0)