-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Use JLine3 #7645
Use JLine3 #7645
Conversation
Thanks for this. It's nice that autocomplete doesn't burn lines of console anymore, the options are updated in-place on subsequent typing. now takes you into the matrix of completions to navigate with a cursor. Previously, we'd detect and emit the signature for the first candidate. I'm sure JLine3 has a better way to render this, perhaps in a status bar. I noticed that ^A ^E no longer go to line start/end all the time. It's probably worth extracting a self-contained, Java-written version of the basic way we rig up JLine in readiness to get support on the JLine mailing list. |
is there anything here that must land early, e.g. in 2.13.0-RC1, in order for the rest to land later in some 2.13.x (perhaps x=0, who knows?) |
Here is the implementation in Dotty for reference. I believe it would be straigforward to port our syntax highlighter |
5df2172
to
52ca56c
Compare
Minimal changes to support new API, with basic completion and history. JLine handles continuation line edit.
52ca56c
to
adee349
Compare
I would accept a hint about how I might have broken
|
We'll take care of the random breakage, I'm happy for you to focus on the core of the jline upgrade. |
I need the green check before I take a step into the mine field. (For now, I'll branch and add features over the pit of quicksand.) |
The osgi minefield looks clear after diff --git a/build.sbt b/build.sbt
index 21b1f1c..ebf67b7 100644
--- a/build.sbt
+++ b/build.sbt
@@ -457,7 +457,14 @@ lazy val compiler = configureAsSubproject(project)
"-doc-root-content", (sourceDirectory in Compile).value + "/rootdoc.txt"
),
Osgi.headers ++= Seq(
- "Import-Package" -> ("jline.*;resolution:=optional," +
+ "Import-Package" -> ("org.jline.keymap.*;resolution:=optional,"+
+ "org.jline.reader.*;resolution:=optional,"+
+ "org.jline.style.*;resolution:=optional,"+
+ "org.jline.terminal;resolution:=optional,"+
+ "org.jline.terminal.impl;resolution:=optional,"+
+ "org.jline.terminal.impl.jansi.*;resolution:=optional,"+
+ "org.jline.terminal.spi;resolution:=optional,"+
+ "org.jline.utils;resolution:=optional,"+
raw"""scala.*;version="$${range;[==,=+);$${ver}}",""" +
"*"),
"Class-Path" -> "scala-reflect.jar scala-library.jar" I don't think we're going to get a ✅ on shipping the LGPL jna library, so we should also drop that dependency. It looks like jansi is all we need? I pushed these diffs to jline3 on my fork (test run: https://scala-ci.typesafe.com/job/scala-2.13.x-validate-main/6696/) |
Just one test failure in that run, btw: test/files/run/repl-paste-parse.scala. |
Right, that was just output order because of ripping out startup dance. I'll PR with updates and more acceptable functionality. |
Excellent, thank you. Let me know if there’s other minefields I can throw myself at :-) |
JNA can be used as Apache2: https://github.com/java-native-access/jna/blob/16aac5fcac290ac05804da222e779e2dba365aa5/LICENSE#L1-L6 |
Thanks. BTW, I just checked out this branch locally to push it over the line, or over the cliff. The current REPL is totally unusable in comparison. :) |
At a coffeeshop in Bern today I was openly drooling at the prospect of getting JLine 3 support in Scala 2. I think the other patrons were staring. |
Strangely enough, I will be at a coffeeshop in Bern again tomorrow, almost exactly one year later, again drooling over the same thing. Residents of Bern: “THAT guy again?" |
I've now been through this PR and extracted remaining TODOs at https://github.com/scala/scala-dev/labels/t%3Ajline3 |
Minimal changes to support new API,
with basic completion and history.
JLine handles continuation line edit.
Gets the ball rolling finally.
-x
formatting and contribute to jlineFixes scala/bug#11367