Skip to content

Commit 3c196b5

Browse files
authored
Merge pull request #5252 from nrjais/repl-history
Save REPL history to file .dotty_history in home directory
2 parents 39e6a49 + 9aef060 commit 3c196b5

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,15 @@ final class JLineTerminal(needsTerminal: Boolean) extends java.io.Closeable {
4747
)(implicit ctx: Context): String = {
4848
import LineReader.Option._
4949
import LineReader._
50-
val lineReader = LineReaderBuilder.builder()
50+
val userHome = System.getProperty("user.home")
51+
val lineReader = LineReaderBuilder
52+
.builder()
5153
.terminal(terminal)
5254
.history(history)
5355
.completer(completer)
5456
.highlighter(new Highlighter)
5557
.parser(new Parser)
58+
.variable(HISTORY_FILE, s"$userHome/.dotty_history") // Save history to file
5659
.variable(SECONDARY_PROMPT_PATTERN, "%M") // A short word explaining what is "missing",
5760
// this is supplied from the EOFError.getMissing() method
5861
.variable(LIST_MAX, 400) // Ask user when number of completions exceed this limit (default is 100).

0 commit comments

Comments
 (0)