This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 251037

Summary: option so <TAB> does not exit/finish completion, only does common prefix
Product: editor Reporter: err <err>
Component: Completion & TemplatesAssignee: Dusan Balek <dbalek>
Status: VERIFIED FIXED    
Severity: normal    
Priority: P2    
Version: 8.0.2   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: possible

Description err 2015-03-09 15:20:27 UTC
It's been a while since I've done a lot of work with NB.  I find I've been 
doing a lot more typing (doing undo and backspace) because of what tab does 
during completion.  The change for Bug 208223 messed things up for me.

The current setup requires a very conscious scan of the completion list in
order to determine what TAB will do; this extra work diminishes the usefulness 
of common prefix completion. I'd prefer to hit tab and know that my next
character input will refine my choices. Now I have to examine the list 
carefully, and then make my editing choice. In addition, since <ENTER> is 
easily available, there's little advantage to using <TAB>.

So if alternate behavior is wanted, an option seems appropriate so it doesn't 
mess with the smooth and interactive feedback feel of tab used only for prefix.
If the completion list only had one element, OK with tab finishing seems OK.

(BTW, I think the change for Bug 208223 is like dumbing down the editor so
that it behaves like IDEA. ;-) )

Example use cases:

Consider
    - enter
        Il<Ctrl-space>
    observe list of several exceptions
    - enter
        <tab>
    observe filling in common prefix

    - note: if <tab> entered again at this point completion finishes
      It could be argued that since the highlighted item shares a common
      prefix that prefix should be completed. Better to do nothing.

    - Consider this one, enter
        Illegal<ctrl-space>
    observe about 6 items,
    - enter
        a
    observe the list goes down to three items. In this case I want one of the
    illegalaccess choices so I
    - enter
        <tab>
    and it completes, even though the highlighted item has a long common
    prefix with the next item. I made a mistake. (I should have entered
    "ac<tab>".)  If after just "a<tab>" nothing had happened it's easy to
    continue; I just enter the "C<tab>", but it's not so easy if it completes.

If there is an issue about the UI, I'd be happy with a system property 
-DCompletionTabOnlyForPrefix or somesuch that I can set during startup
while the UX people sort things out.
Comment 1 err 2015-03-09 19:58:15 UTC
Created attachment 152511 [details]
possible

Attached a patch that shows proof of concept. It only executes the change from Bug 208223 when Boolean.getBoolean("editor.completion.TabOnlyForPrefix") is false. If the system property is true then you get the original behavior.

I made no attempt to understand the surrounding code; it seems to work.

It's a proof of concept. I suppose it could be used as is, but caching the value of Boolean.getBoolean("editor.completion.TabOnlyForPrefix") might be good.
Comment 2 Dusan Balek 2015-03-10 14:06:55 UTC
'org.netbeans.modules.editor.completion.noTabCompletion' option added.

http://hg.netbeans.org/jet-main/rev/7d4647535f38
Comment 3 Quality Engineering 2015-03-13 03:13:56 UTC
Integrated into 'main-silver', will be available in build *201503130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/7d4647535f38
User: Dusan Balek <dbalek@netbeans.org>
Log: Issue #251037: option so <TAB> does not exit/finish completion, only does common prefix - fixed.