Skip to content

Commit

Permalink
fix: set default python execute to python 3 and update && closed #146
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 29, 2024
1 parent c172e50 commit 3f57680
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ interface FileRunService {

fun runInCli(project: Project, psiFile: PsiFile, args: List<String>? = null): String? {
val commandLine = when (psiFile.language.displayName.lowercase()) {
"python" -> GeneralCommandLine("python", psiFile.virtualFile.path)
"python" -> GeneralCommandLine("python3", psiFile.virtualFile.path)
"javascript" -> GeneralCommandLine("node", psiFile.virtualFile.path)
"ecmascript 6" -> GeneralCommandLine("node", psiFile.virtualFile.path)
"ruby" -> GeneralCommandLine("ruby", psiFile.virtualFile.path)
Expand All @@ -173,14 +173,15 @@ interface FileRunService {
output.stdout
} catch (e: Exception) {
e.printStackTrace()
null
e.message
}
}

fun runInCli(project: Project, virtualFile: VirtualFile, args: List<String>? = null): String? {
val psiFile = runReadAction {
PsiManager.getInstance(project).findFile(virtualFile)
} ?: return null

return runInCli(project, psiFile, args)
}

Expand Down

0 comments on commit 3f57680

Please sign in to comment.