Skip to content

Commit b60d90f

Browse files
Merge pull request #14521 from ckipp01/reset
improvement(repl): add in feedback when resetting REPL state
2 parents c1071d6 + e839d0f commit b60d90f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

compiler/src/dotty/tools/repl/ReplDriver.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,16 @@ class ReplDriver(settings: Array[String],
391391
state
392392

393393
case Reset(arg) =>
394-
resetToInitial(tokenize(arg))
394+
val tokens = tokenize(arg)
395+
396+
if tokens.nonEmpty then
397+
out.println(s"""|Resetting REPL state with the following settings:
398+
| ${tokens.mkString("\n ")}
399+
|""".stripMargin)
400+
else
401+
out.println("Resetting REPL state.")
402+
403+
resetToInitial(tokens)
395404
initialState
396405

397406
case Imports =>

compiler/test-resources/repl/reset-command

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ there were 1 deprecation warning(s); re-run with -deprecation for details
33
def f(thread: Thread): Unit
44

55
scala>:reset -deprecation
6+
Resetting REPL state with the following settings:
7+
-deprecation
68

79
scala> def f(thread: Thread) = thread.stop()
810
1 warning found
@@ -16,6 +18,7 @@ scala> def resetNoArgsStillWorks = 1
1618
def resetNoArgsStillWorks: Int
1719

1820
scala>:reset
21+
Resetting REPL state.
1922

2023
scala> resetNoArgsStillWorks
2124
-- [E006] Not Found Error: -----------------------------------------------------

0 commit comments

Comments
 (0)