Skip to content

Commit ee5b1f1

Browse files
committed
🐛 Fix issue with evaluation of expr with str literals
1 parent 6ef3ca3 commit ee5b1f1

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88

99

1010
group = "com.uriyyo.evaluate_async_code"
11-
version = "1.5"
11+
version = "1.6"
1212

1313
repositories {
1414
mavenCentral()

src/main/java/com/uriyyo/evaluate_async_code/AsyncPyDebugRunner.kt

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import com.jetbrains.python.debugger.PyDebugProcess
66
import com.jetbrains.python.debugger.PyDebugRunner
77
import com.jetbrains.python.debugger.PyDebugValue
88
import com.jetbrains.python.run.PythonCommandLineState
9-
import com.jetbrains.rd.util.string.printToString
109
import java.net.ServerSocket
1110

1211
class AsyncPyDebugRunner : PyDebugRunner() {
@@ -27,9 +26,10 @@ class AsyncPyDebugRunner : PyDebugRunner() {
2726
// FIXME: why so terrible? this code must be refactored
2827
super.evaluate(PLUGIN, true, true)
2928

29+
// TODO: Does Kotlin has smth like python repr?
3030
val fixedExpression = expression
31-
.printToString()
32-
.replace("\n", "\\n")
31+
.replace("'''", "\\'\\'\\'")
32+
.let { "'''$it'''" }
3333

3434
val code = "__async_result__ = __import__('sys').__async_eval__($fixedExpression, globals(), locals())"
3535
super.evaluate(code, true, doTrunc)

src/main/resources/META-INF/plugin.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
<idea-plugin>
22
<id>com.uriyyo.evaluate_async_code</id>
33
<name>Evaluate async code</name>
4-
<version>1.5</version>
4+
<version>1.6</version>
55
<vendor email="[email protected]">Yurii Karabas</vendor>
66

77
<description>
88
Finally, you can use async/await during debugging your code.
99
Currently supports: evaluate an expression, conditional breakpoints, console window.
1010
</description>
1111

12-
<change-notes>Fix "Syntax Error" exception when trying to execute async expression</change-notes>
12+
<change-notes>Fix "Syntax Error" exception when trying to execute async expression with string literals</change-notes>
1313

1414
<idea-version since-build="192"/>
1515
<depends>com.intellij.modules.lang</depends>

0 commit comments

Comments
 (0)