-
Notifications
You must be signed in to change notification settings - Fork 3.1k
REPL: JLine 3: improve tab completion behavior #8905
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
Conversation
1749a23 to
b49a9f4
Compare
b49a9f4 to
5eb5124
Compare
som-snytt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your "Vissi d'arte" moment if there ever was one.
|
|
lrytz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few small questions. run/repl-completions.scala needs an update-check.
actually that's a real regression in how |
no specific motivation, it just seems likely that we'll want bugfixes. I don't see anything in the changelog that looks alarming (though also nothing specifically appealing)
5eb5124 to
ee2b5ae
Compare
|
final fix was --- src/repl-frontend/scala/tools/nsc/interpreter/shell/ILoop.scala
+++ src/repl-frontend/scala/tools/nsc/interpreter/shell/ILoop.scala
@@ -550,14 +550,17 @@ class ILoop(config: ShellConfig, inOverride: BufferedReader = null,
// it's also used by ReplTest
def completionsCommand(what: String): Result = {
val completions = in.completion.complete(what, what.length)
- if (completions.candidates.nonEmpty) {
+ val candidates = completions.candidates.filterNot(_.isUniversal)
+ // condition here is a bit weird because of the weird hack we have where
+ // the first candidate having an empty defString means it's not really
+ // completion, but showing the method signature instead
+ if (candidates.headOption.exists(_.defString.nonEmpty)) {
val prefix =
if (completions == NoCompletions) ""
else what.substring(0, completions.cursor)
// hvesalai (emacs sbt-mode maintainer) says it's important to echo only once and not per-line
echo(
- completions.candidates
- .map(c => s"[completions] $prefix$c")
+ candidates.map(c => s"[completions] $prefix${c.defString}")
.mkString("\n")
)
} |
|
I feel like a Tab Hunter pun is warranted. |
fixes scala/scala-dev#698