Skip to content

Commit 38b2279

Browse files
authored
Merge pull request scala#6553 from Jasper-M/topic/printFilter
Unmangle the output of //print in the REPL
2 parents 31b7106 + e8c9542 commit 38b2279

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/repl-frontend/scala/tools/nsc/interpreter/shell/ReplCompletion.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package scala.tools.nsc.interpreter.shell
77
import scala.util.control.NonFatal
88
import scala.tools.nsc.interpreter.Repl
99
import scala.tools.nsc.interpreter.jline
10+
import scala.tools.nsc.interpreter.Naming
1011

1112
class ReplCompletion(intp: Repl) extends jline.JLineCompletion {
1213
import ReplCompletion._
@@ -58,13 +59,15 @@ class ReplCompletion(intp: Repl) extends jline.JLineCompletion {
5859

5960
// secret handshakes
6061
val slashPrint = """.*// *print *""".r
62+
val slashPrintRaw = """.*// *printRaw *""".r
6163
val slashTypeAt = """.*// *typeAt *(\d+) *(\d+) *""".r
6264
try {
6365
intp.presentationCompile(cursor, buf) match {
6466
case Left(_) => NoCompletions
6567
case Right(result) => try {
6668
buf match {
67-
case slashPrint() if cursor == buf.length => CompletionResult(cursor, "" :: result.print :: Nil)
69+
case slashPrint() if cursor == buf.length => CompletionResult(cursor, "" :: Naming.unmangle(result.print) :: Nil)
70+
case slashPrintRaw() if cursor == buf.length => CompletionResult(cursor, "" :: result.print :: Nil)
6871
case slashTypeAt(start, end) if cursor == buf.length => CompletionResult(cursor, "" :: result.typeAt(start.toInt, end.toInt) :: Nil)
6972
case _ => val (c, r) = result.candidates(tabCount); CompletionResult(c, r)
7073
}

0 commit comments

Comments
 (0)