@@ -6,6 +6,7 @@ import com.jetbrains.python.debugger.PyDebugProcess
6
6
import com.jetbrains.python.debugger.PyDebugRunner
7
7
import com.jetbrains.python.debugger.PyDebugValue
8
8
import com.jetbrains.python.run.PythonCommandLineState
9
+ import com.jetbrains.rd.util.string.printToString
9
10
import java.net.ServerSocket
10
11
11
12
class AsyncPyDebugRunner : PyDebugRunner () {
@@ -22,7 +23,20 @@ class AsyncPyDebugRunner : PyDebugRunner() {
22
23
session, serverSocket, result.executionConsole, result.processHandler, pyState.isMultiprocessDebug
23
24
) {
24
25
override fun evaluate (expression : String? , execute : Boolean , doTrunc : Boolean ): PyDebugValue {
25
- super .evaluate(PLUGIN , true , true )
26
+ if (expression?.isAsyncCode == true ) {
27
+ // FIXME: why so terrible? this code must be refactored
28
+ super .evaluate(PLUGIN , true , true )
29
+
30
+ val fixedExpression = expression
31
+ .printToString()
32
+ .replace(" \n " , " \\ n" )
33
+
34
+ val code = " __async_result__ = __async_eval__($fixedExpression , globals(), locals())"
35
+ super .evaluate(code, true , doTrunc)
36
+
37
+ return super .evaluate(" __async_result__" , false , doTrunc)
38
+ }
39
+
26
40
return super .evaluate(expression, execute, doTrunc)
27
41
}
28
42
}
0 commit comments