RFR 9: JDK-8177076: jshell tool: usability of completion

Robert Field robert.field at oracle.com
Mon Mar 27 21:20:24 UTC 2017


ConsoleIOContext.java
----------------------------

One of the key pieces of usability feedback was to step away from modal 
prompts.
Where, the cycle is on-tab: next-info/redraw.
These changes move to that mechanism.
However, the "too many completions" case uses a modal prompt (556).
Seems this could be handled the same way.

Nit: the variable declared on line 211: "String test", is that intended 
to be "text"?

SourceCodeAnalysisImpl.java
------------------------------------

These changes appear to be incomplete or abandoned.  They introduce a 
variable that is never set.

User Interface
------------------

jshell> List li
l ==> null

jshell> li.<tab>
add(               addAll(            clear() contains(          
containsAll(       equals( forEach(           get(               getClass()
hashCode()         indexOf(           isEmpty() iterator()         
lastIndexOf(       listIterator( notify()           notifyAll()        
parallelStream()
remove(            removeAll(         removeIf( replaceAll(        
retainAll(         set( size()             sort(              spliterator()
stream()           subList(           toArray( toString()         wait(

jshell> li.add<tab>
add(      addAll(

jshell> li.add(<tab>
Current signatures:
boolean List<E extends Object>.add(E e)
void List<E extends Object>.add(int index, E element)

Possible completions:

l     xxx   xyz

<press tab again to see documentation>

jshell> li.add(

The first and second tab used in the example above give possible 
completions without a leading header "Possible completions:" of the 
third case. This should be consistent.
The header could be added everywhere, but I think that would be noisy.  
The change in ordering is confusing anyhow.
The prompt "<press tab again to see documentation>" would be more 
intuitive grouped with the method signatures.
The header "Current signatures:", I think would be better 
"Signatures:",  "Method signatures:", or "Signatures of add:".
Applying these:

jshell> li.add(<tab>
l     xxx   xyz

Method signatures:
boolean List<E extends Object>.add(E e)
void List<E extends Object>.add(int index, E element)

<press tab again to see documentation>

jshell> li.add(

See above, under ConsoleIOContext.java, additionally, the inlining of 
more text makes this more confusing, as no indication of what to do if 
you don't want it --

jshell> 4 + <tab>

Gets replaced with:

jshell> 4 + 542 possible completions. Press <tab> or y to see them all.

I'd opt for consistency (which also uses this prompt that is used in the 
after documentation case):

jshell> 4 + <tab>
<press tab again to see all possible completions; total possible completions: 542>

jshell> 4 +

I see also that if documentation is displayed and there are smart items, 
then the last tab choice is all items.  In no other case are all items 
offered if there are smart items.

The command help is a very nice feature.

I'm unsure of the "<press tab again to see synopsis>" prompt line as the 
synopsis is also one line.

Overall
---------

Perhaps it would be good to lay this out as a UI design before turning 
it into code.

Naively (as I haven't done it), I think it may be possible to regularize 
the processing (starting as pseudo-code derived from the UI design).
I note 19 conditionals in the new code. I'm concerned about the 
branching complexity not only for code maintenance and testing but for 
what it implies about the user model.

I will be available to help on this tomorrow, if you would like.

-Robert


On 03/27/17 01:39, Jan Lahoda wrote:
> Hello,
>
> I'd like to ask for a review of a patch that merges shift-tab and tab 
> completions, and changes the fix shortcut to shift-tab:
> Bug: https://bugs.openjdk.java.net/browse/JDK-8177076
> Webrev: http://cr.openjdk.java.net/~jlahoda/8177076/webrev.00/
>
> Any feedback is welcome,
>      Jan



More information about the kulla-dev mailing list