Skip to content

simple integration with jline #1204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bin/dotc
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ unset verbose quiet cygwin toolcp colors saved_stty CDPATH

CompilerMain=dotty.tools.dotc.Main
FromTasty=dotty.tools.dotc.FromTasty
ReplMain=test.DottyRepl
ReplMain=dotty.tools.dotc.repl.Main



Expand Down
11 changes: 3 additions & 8 deletions src/dotty/tools/dotc/repl/InteractiveReader.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,19 @@ trait InteractiveReader {
val interactive: Boolean
}

/** TODO Enable jline support.
* The current Scala REPL know how to do this flexibly.
/** The current Scala REPL know how to do this flexibly.
*/
object InteractiveReader {
/** Create an interactive reader. Uses JLine if the
* library is available, but otherwise uses a
* SimpleReader. */
def createDefault(): InteractiveReader = new SimpleReader()
/*
{
def createDefault(): InteractiveReader = {
try {
new JLineReader
new JLineReader()
} catch {
case e =>
//out.println("jline is not available: " + e) //debug
new SimpleReader()
}
}
*/

}
15 changes: 15 additions & 0 deletions src/dotty/tools/dotc/repl/JLineReader.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package dotty.tools
package dotc
package repl

import jline.console.ConsoleReader

/** Adaptor for JLine
*/
class JLineReader extends InteractiveReader {
val reader = new ConsoleReader()

val interactive = true

def readLine(prompt: String) = reader.readLine(prompt)
}