Skip to content

REPL: Make use of fancy JLine (3) features #12272

Open
@lrytz

Description

@lrytz

Breifly looking through JLine's tickets and examples, there are a number of features that we could potentially make use of to brush up the REPL experience.

Their example class: https://github.com/jline/jline3/blob/master/builtins/src/test/java/org/jline/example/Example.java

I managed to get it to run with mvn install and then running

java -cp builtins/target/classes:builtins/target/test-classes:reader/target/classes:terminal/target/classes org.jline.example.Example

and providing some random args that are then suggested (color, argument, mouse, ...). Then typing tab shows a completion matrix.

There's also the ./demo/jline-repl.sh that you can run after mvn install, not sure what it does :-)

Some features to look at

  • Groups for completions. For example, we could have groups for "core members", "extension methods", "deprecated members", "inherited from AnyRef/Any". This would replace the feature that today more members show up when requesting the same completion twice. random screenshot

  • Show signature of method in a "status bar", or maybe in a completion "group" at the bottom that is visually different. This should replace the double tab feature that today shows the signature of the method in the prompt. It could also display the signature of a member when navigating through the completion matrix with the arrow keys.

    • java -cp builtins/target/classes:builtins/target/test-classes:reader/target/classes:terminal/target/classes org.jline.example.Example status shows a status bar with a counter at the bottom, maybe we can use that?
    • Provide a better auto-suggestion mechanism jline/jline3#254 is a feature request for something similar.
    • There's a feature called TailTipWidgets, I'm not exactly sure what it is, maybe the light-gray explanation that shows up next to completion items when running org.jline.example.Example argument. Picture:
      image
    • For some commands in the Example program, hitting tab after a command is entered, a suggestion in gray then shows up on the next line. This looks like what we could use for signatures.
      image
  • Maybe use autosuggestion? Suggests completing the current command being entered as you type.

  • mouse enables moving the cursor with mouse clicks

There is probably more in JLine that we can make use of.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions