Do not insert additional new lines in REPL
This commit is contained in:
@@ -21,6 +21,7 @@ import com.intellij.execution.process.OSProcessHandler
|
||||
import com.intellij.execution.process.ProcessOutputTypes
|
||||
import com.intellij.openapi.util.Key
|
||||
import org.jetbrains.kotlin.cli.common.repl.replInputAsXml
|
||||
import org.jetbrains.kotlin.cli.common.repl.replNormalizeLineBreaks
|
||||
import org.jetbrains.kotlin.cli.common.repl.replRemoveLineBreaksInTheEnd
|
||||
import org.jetbrains.kotlin.cli.common.repl.replUnescapeLineBreaks
|
||||
import org.jetbrains.kotlin.console.KotlinConsoleKeeper
|
||||
@@ -123,7 +124,7 @@ class KtScratchReplExecutor(file: ScratchFile) : ScratchExecutor(file) {
|
||||
|
||||
val root = output.firstChild as Element
|
||||
val outputType = root.getAttribute("type")
|
||||
val content = root.textContent.replUnescapeLineBreaks().replRemoveLineBreaksInTheEnd()
|
||||
val content = root.textContent.replUnescapeLineBreaks().replNormalizeLineBreaks().replRemoveLineBreaksInTheEnd()
|
||||
|
||||
LOG.printDebugMessage("REPL output: $outputType $content")
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.execution.process.OSProcessHandler
|
||||
import com.intellij.execution.process.ProcessOutputTypes
|
||||
import com.intellij.openapi.util.Key
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import org.jetbrains.kotlin.cli.common.repl.replNormalizeLineBreaks
|
||||
import org.jetbrains.kotlin.cli.common.repl.replUnescapeLineBreaks
|
||||
import org.jetbrains.kotlin.console.actions.logError
|
||||
import org.jetbrains.kotlin.diagnostics.Severity
|
||||
@@ -75,7 +76,7 @@ class ReplOutputHandler(
|
||||
|
||||
val root = output.firstChild as Element
|
||||
val outputType = ReplEscapeType.valueOfOrNull(root.getAttribute("type"))
|
||||
val content = root.textContent.replUnescapeLineBreaks()
|
||||
val content = root.textContent.replUnescapeLineBreaks().replNormalizeLineBreaks()
|
||||
|
||||
when (outputType) {
|
||||
INITIAL_PROMPT -> buildWarningIfNeededBeforeInit(content)
|
||||
|
||||
-2
@@ -1,6 +1,4 @@
|
||||
foo() // ERROR: error: unresolved reference: foo...
|
||||
/** unresolved.kts:1 error: unresolved reference: foo
|
||||
|
||||
foo()
|
||||
|
||||
^ */
|
||||
@@ -6,20 +6,13 @@ fun goo(a: String) { // ERROR: error: unresolved reference: goo...
|
||||
super.goo(a)
|
||||
}
|
||||
/** unresolvedMultiline.kts:1 error: unresolved reference: foo
|
||||
|
||||
foo.forEach {
|
||||
|
||||
^
|
||||
|
||||
error: cannot choose among the following candidates without completing type inference:
|
||||
@HidesMembers public inline fun <T> Iterable<???>.forEach(action: (???) -> Unit): Unit defined in kotlin.collections
|
||||
@HidesMembers public inline fun <K, V> Map<out ???, ???>.forEach(action: (Map.Entry<???, ???>) -> Unit): Unit defined in kotlin.collections
|
||||
|
||||
foo.forEach {
|
||||
|
||||
^ */
|
||||
/** unresolvedMultiline.kts:5 error: unresolved reference: goo
|
||||
|
||||
super.goo(a)
|
||||
|
||||
^ */
|
||||
Reference in New Issue
Block a user