scala / bug

Scala 2 bug reports only. Please, no questions — proper bug reports only.
https://scala-lang.org
231 stars 21 forks source link

REPL: tab completion: use JLine grouping feature to present choices in groups #12281

Open SethTisue opened 3 years ago

SethTisue commented 3 years ago

The main goal is to deemphasize deprecated methods and universal methods.

We attempted this for 2.13.3 but were blocked by JLine bugs (or so it seemed to me, I don't think I was just doing it wrong?). The situation may be improved in recent JLine releases, see e.g. https://github.com/jline/jline3/issues/613#issuecomment-739320791. some old WIP on this https://github.com/SethTisue/scala/commits/jline3-group-based

We might also want to separate extension methods from built-in methods?

A stretch goal could be to use the Scaladoc groupings (idea from @martijnhoekstra)

SethTisue commented 3 years ago

how to use a local build of JLine 3: mvn install from the JLine repo to publish to ~/m2, then edit our versions.properties, e.g.:

-jline.version=3.17.1
+jline.version=3.17.2-SNAPSHOT

then set Global / resolvers += Resolver.mavenLocal (but it won't work if you have -Dsbt.override.build.repos=true in your SBT_OPTS)

SethTisue commented 3 years ago

I rebased my WIP branch.

Regardless of whether we use JLine 3.17.1 or a locally built snapshot, the current behavior is as follows. When you first hit TAB, it works:

Screen Shot 2020-12-09 at 1 21 48 PM

but then as you soon as you tab into the groups, the groups vanish:

Screen Shot 2020-12-09 at 1 22 25 PM

which has been reported at https://github.com/jline/jline3/issues/613

ah, but in https://github.com/jline/jline3/commit/538b7fa81bf73710ff4d596807386a7d8524ede4 the fix is that you have to explicitly ask for GROUP_PERSIST(false), let me try that

SethTisue commented 3 years ago

okay GROUP_PERSIST(false) gives behavior that seems okay first, but then pretty quickly you discover that arrow key navigation is all messed up, both up/down arrow and left/right arrow behave weirdly (in different ways)

and that's https://github.com/jline/jline3/issues/580 , which was closed, but not because it actually got fixed

SethTisue commented 3 years ago

conclusion: I'm taking this off the 2.13.5 milestone and backlogging it. let's hope this eventually gets fixed upstream.

or, would a volunteer like to try and fix it upstream...?