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:
observe list of several exceptions
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
observe about 6 items,
observe the list goes down to three items. In this case I want one of the
illegalaccess choices so I
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.
Created attachment 152511 [details]
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.
'org.netbeans.modules.editor.completion.noTabCompletion' option added.
Integrated into 'main-silver', will be available in build *201503130001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
User: Dusan Balek <firstname.lastname@example.org>
Log: Issue #251037: option so <TAB> does not exit/finish completion, only does common prefix - fixed.