Bug 4978 - Completion list not ordered as expected
Summary: Completion list not ordered as expected
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: PC other
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Claude Knaus CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 4361 5991 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-10-15 09:34 EDT by Randy Giffen CLA
Modified: 2002-07-02 05:09 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Giffen CLA 2001-10-15 09:34:26 EDT
Type "fo" and press ctrl-space
The best matches are the "for" templates but they are at the end of the list
Comment 1 Claude Knaus CLA 2001-10-18 09:14:07 EDT
Since template proposals are merged with code-assist proposals, there are the
following options, under the constraint of consistency:

  1) Reorder code assist proposals to meet your 'expected' behaviour.
     Code assist proposals are currently sorted first by category, then by
     prefix match. We should ask first the code assist people if they
     share the same view.

  2) Leave code assist proposals as is and prepend template proposals
     to the beginning of the list. 
     This is how it was before. We could use template names which are
     less likely to collide with types or methods.

  3) Leave code assist proposals as is and append template proposals
     to the end of the list.

  4) Don't mess with code assist. Use CTRL-J for code-assist like
     template selection.


I'm still favoring 4), followed by 2).
Comment 2 Claude Knaus CLA 2001-10-19 10:44:13 EDT
reverted to proposal 2)
we can reopen this bug again, if it turns out to be unsatisfactory.
Comment 3 Claude Knaus CLA 2001-11-16 06:32:29 EST
*** Bug 5991 has been marked as a duplicate of this bug. ***
Comment 4 Claude Knaus CLA 2001-11-16 06:33:01 EST
There has been already a lot of discussions on this, so I summarize the 
proposals again:

  1) Separate key-combo for templates. As you said, this would require some
     modification in the editor. 

  2) Display templates at the bottom of the list. The drawback is that in
     many cases, the user wouldn't even be aware that there are templates
     at the end of the list. Pressing END is also cumbersome.

  3) Be context sensitive. I don't know how (in-)efficient it would be to
     gather the required context. The context could be: class,
     method, statement, expression, etc. This would require additional
     specification by the user when creating a new template.

  4) Limit clashes of template names with other proposals. For example
     rename templates to start with some special character, like '_'.
     Or be case-sensitive in case of producing template proposals.

     The way I use code assist I type the first few characters, which
     rarely clash with a template, so it usually doesn't bother me.
Comment 5 Randy Giffen CLA 2001-11-16 12:11:37 EST
I don't like option 1) as it is something else for me to discover/learn/remember

I have the following suggestions (I'm not sure if you get all the information 
you need from core but you might be able to get it yourself before you call 
them)

a)Don't offer template completions after a '.' 
That is, if the character before the first character you would replace with the 
completion is a '.'
I don't see a useful reason to have templates in this context. Users expect 
only valid completions after a '.'

b)Order the list to show the "best match" first (typically this will mean you 
will have to check case). If I complete on 'whi' I want to see the while 
templates before types beginning with 'Whi' and vise-versa
Comment 6 Erich Gamma CLA 2001-11-19 06:01:31 EST
It looks like we are in agreement that we don't want a separate key-combo.

The '.' heuristic is a good start, but it doesn't help when I start typing a 
local variable that starts with f. Getting a "for" template suggestion is not 
helpful. Some templates only make sense in the context of a keyword (e.g. 
while, for) but not all of them. I wonder how we could leverage this.

CCing Philippe: what kind of support could code assist offer to provide 
additional context like "in keyword" (ignoring scheduling constraints)
Comment 7 Claude Knaus CLA 2001-12-17 04:56:21 EST
*** Bug 4361 has been marked as a duplicate of this bug. ***
Comment 8 Adam Kiezun CLA 2002-02-27 06:39:38 EST
PM was not added to CC before
Comment 9 Claude Knaus CLA 2002-07-02 05:09:44 EDT
in 2.0

Templates have high priorities if code assist is triggered after a whitespace,
otherwise the priority is low.