bug
bug copied to clipboard
REPL: grab bag of tab completion issues/improvements
if something is a blocker for some 2.13.x release, remove it from here and give it its own ticket
doc: https://github.com/jline/jline3/wiki/Completion
on the PR Som wrote:
Tried it out. Did Jline completion always tab through alternatives? Some ordinary completion is broken, however, and will need repair.
(Actually I couldn't reproduce: c tab displayed cc and was stuck. Reminiscent of scala/bug#10914.)
I guess the val c: C used to be shown below the line as an explanatory result?
scala> class C defined class C
scala> val c = new C c: C = C@58a7dc4
scala> val c: C // c tab
"Completion suggestions have changed when the cursor is midway through an identifier" (https://github.com/scala/scala/pull/8036#issuecomment-525145239)
https://github.com/scala/scala/pull/7645#issuecomment-454269972: "I noticed that ^A ^E no longer go to line start/end all the time."
Throwing into the grab bag:
scala> class Foo
class Foo
scala> val f = new Foo<tab>
fills to
scala> val f = new def <init>(): Foo
That seems to be the same bug as https://github.com/scala/scala-dev/issues/696
JShell does a nice thing where it shows whether the method has parameters or not:
jshell> class C { int x; void foo(int y) { }; void bar() { } }
| replaced class C
jshell> new C().
bar() equals( foo( getClass() hashCode() notify() notifyAll()
toString() wait( x
there's x (field, no parens), bar() (nilary method), and foo( (method with at least one param)
I closed https://github.com/scala/scala-dev/issues/698 with https://github.com/scala/scala/pull/8905 but there are still a number of ways the UX could be better; 698 has some commentary with details
scala/scala#8905 indicates whether a method is nullary, nilary, or other by showing nothing, (), or (. @lrytz suggested that it ought to insert the parens for you when you chose that completion. I believe JLine does support this through the "suffix" field. Something to try.
I just noticed 2.13.6 // print tab completion looked like
scala> 1 + 1 // print
(1).+(1) // : Int(2)
and now it does a weird thing where it does completions but with 2 columns (blank left column) and it prints wrong when highlighting the right column. These are 3 tabs, redrawing the line:
scala> 1 + 1 // print
(1).+(1) // : Int(2)
scala> 1 + 1 // print
(1).+(1) // : Int(2)
scala> 1 + 1 // print(1).+(1) // : Int(2)
(1).+(1) // : Int(2)
This is on WSL, so maybe something else is going on. Or maybe the improvement to regular completions introduced this behavior for // print completion. Not worth a ticket, however.
Forgot the umbrella when I https://github.com/scala/bug/issues/12843 "Show me the parameters"