Skip to content

Conversation

@SethTisue
Copy link
Member

@SethTisue SethTisue commented Apr 22, 2020

@scala-jenkins scala-jenkins added this to the 2.13.3 milestone Apr 22, 2020
@SethTisue SethTisue force-pushed the jline3-improved-completion branch from 1749a23 to b49a9f4 Compare April 22, 2020 04:02
@SethTisue SethTisue requested review from lrytz and som-snytt April 22, 2020 04:04
@SethTisue SethTisue modified the milestones: 2.13.3, 2.13.2 Apr 22, 2020
@SethTisue SethTisue added the tool:REPL Changes to the Scala REPL shell label Apr 22, 2020
@SethTisue SethTisue force-pushed the jline3-improved-completion branch from b49a9f4 to 5eb5124 Compare April 22, 2020 05:21
Copy link
Contributor

@som-snytt som-snytt left a 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.

@som-snytt
Copy link
Contributor

run/repl-completions.scala for :completions.

Copy link
Member

@lrytz lrytz left a 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.

@SethTisue
Copy link
Member Author

run/repl-completions.scala needs an update-check

actually that's a real regression in how :completions behaves! I'll fix it now

@SethTisue SethTisue self-assigned this Apr 22, 2020
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)
@SethTisue SethTisue force-pushed the jline3-improved-completion branch from 5eb5124 to ee2b5ae Compare April 22, 2020 18:52
@SethTisue SethTisue merged commit 7d29ccc into scala:2.13.x Apr 22, 2020
@SethTisue SethTisue deleted the jline3-improved-completion branch April 22, 2020 20:00
@SethTisue
Copy link
Member Author

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")
       )
     }

@som-snytt
Copy link
Contributor

I feel like a Tab Hunter pun is warranted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tool:REPL Changes to the Scala REPL shell

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JLine 3: resolve double-tab behavior somehow for 2.13.2

4 participants