Skip to content

Commit ae2474f

Browse files
committed
Tweak JLine configurations
1 parent 19e4270 commit ae2474f

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

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

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ import dotty.tools.dotc.printing.SyntaxHighlighting
77
import dotty.tools.dotc.reporting.Reporter
88
import dotty.tools.dotc.util.SourceFile
99
import org.jline.reader
10-
import org.jline.reader.LineReader.Option
10+
import org.jline.reader.LineReader.Option._
11+
import org.jline.reader.LineReader._
1112
import org.jline.reader.Parser.ParseContext
1213
import org.jline.reader._
1314
import org.jline.reader.impl.history.DefaultHistory
@@ -49,9 +50,10 @@ final class JLineTerminal extends java.io.Closeable {
4950
.completer(completer)
5051
.highlighter(new Highlighter)
5152
.parser(new Parser)
52-
.variable(LineReader.SECONDARY_PROMPT_PATTERN, "%M")
53-
.option(Option.INSERT_TAB, true) // at the beginning of the line, insert tab instead of completing
54-
.option(Option.AUTO_FRESH_LINE, true) // if not at start of line before prompt, move to new line
53+
.variable(SECONDARY_PROMPT_PATTERN, "%M")
54+
.variable(LIST_MAX, 400) // ask user when number of completions exceed this limit (default is 100)
55+
.option(INSERT_TAB, true) // at the beginning of the line, insert tab instead of completing
56+
.option(AUTO_FRESH_LINE, true) // if not at start of line before prompt, move to new line
5557
.build()
5658

5759
lineReader.readLine(prompt)
@@ -70,11 +72,14 @@ final class JLineTerminal extends java.io.Closeable {
7072
/** Provide multi-line editing support */
7173
private class Parser(implicit ctx: Context) extends reader.Parser {
7274

75+
/**
76+
* @param cursor The cursor position within the line
77+
* @param line The unparsed line
78+
* @param word The current word being completed
79+
* @param wordCursor The cursor position within the current word
80+
*/
7381
private class ParsedLine(
74-
val cursor: Int, // The cursor position within the line
75-
val line: String, // The unparsed line
76-
val word: String, // The current word being completed
77-
val wordCursor: Int // The cursor position within the current word
82+
val cursor: Int, val line: String, val word: String, val wordCursor: Int
7883
) extends reader.ParsedLine {
7984
// Using dummy values, not sure what they are used for
8085
def wordIndex = -1

0 commit comments

Comments
 (0)