Bug 81403 - Completion improvement.
Summary: Completion improvement.
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0   Edit
Assignee: Alain Magloire CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2004-12-16 10:05 EST by Tomaszewski Przemek CLA
Modified: 2009-01-09 14:58 EST (History)
1 user (show)

See Also:


Attachments
Adds the improvement. (7.32 KB, patch)
2004-12-16 10:06 EST, Tomaszewski Przemek CLA
bjorn.freeman-benson: iplog+
Details | Diff
Rewritten solution (7.55 KB, patch)
2004-12-17 05:13 EST, Tomaszewski Przemek CLA
bjorn.freeman-benson: iplog+
Details | Diff
It removes repeated completions. (2.08 KB, patch)
2005-01-17 09:02 EST, Tomaszewski Przemek CLA
bjorn.freeman-benson: iplog+
Details | Diff
Replacement ArrayList with Vector (2.65 KB, patch)
2005-01-18 03:27 EST, Tomaszewski Przemek CLA
bjorn.freeman-benson: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomaszewski Przemek CLA 2004-12-16 10:05:22 EST
Improvement for completion. Adds fast completion feature which complete
proposals parts, if all of them are the same.
Comment 1 Tomaszewski Przemek CLA 2004-12-16 10:06:01 EST
Created attachment 16695 [details]
Adds the improvement.
Comment 2 John Camelon CLA 2004-12-16 10:23:03 EST
Please explain what a "fast completion" is?
Comment 3 Tomaszewski Przemek CLA 2004-12-16 10:25:21 EST
If prefix is:
APP_EX
and proposals are:
APP_EXIT_FULL
APP_EXIT_NONE
APP_EXIT_ONE_LEVEL

it completes:
APP_EXIT
without proposals popup.
Comment 4 Alain Magloire CLA 2004-12-16 11:38:28 EST
> it completes:
> APP_EXIT
> without proposals popup.

And with which one ? it seems that
APP_EXIT_FULL
APP_EXIT_NONE
APP_EXIT_ONE_LEVEL

are all valid proposals for APP_EXIT
I did not look at the patch yet, but is "fast" a misnomer for
best guess proposal ..  And you guess is base on what algo.


Comment 5 Alain Magloire CLA 2004-12-16 13:13:35 EST
Allright, I took the time to loo at this in more detail.
(1) you have to do completion twice  8-(
  So if we look at the example

AP_EX

the completion will complete to AP_EXIT but I'll have to hit
CTRL_Space again ... to get the lists.

(2) Sometimes we use completion, just to see the possibilities
now it will be necessary to erase the partial hits.

(2) is not that bad but (1) is an issue.

Also note:
(a) there is a bug, if I have
      foo_bar_full()
      foo_bar_complete()
      foo_bar_none()
    as functions
   after doing "foo_bar", go back and
   try to with "foo" only no proposals are presented
(b) potentialof IndexOutOfbound exception.

Because of those reasons I'm not too inclined to apply this patch
What do you think ?
Comment 6 Alain Magloire CLA 2004-12-16 14:13:41 EST
Looked at the JDT UI, .. guess what they have a preference
to take care of problem (1) (detail in the previous post)
See JDT Preference
Java --> Editor --> Code Assist -->"Insert common prefix automatically"

So that take care of my objections.

I will not apply the patch yet because there some buggy behaviours
that it introduce...
So do you want to take a second pass at it ?
Comment 7 Tomaszewski Przemek CLA 2004-12-17 02:09:27 EST
It works as I would like to work:). It completes to the nearest separator (in
your case is _ after foo so there is no completition popup, no array out of
bounds), but I've looked into JDT behaviour and I rewrite it to work in the same
way.
Comment 8 Tomaszewski Przemek CLA 2004-12-17 05:13:26 EST
Created attachment 16722 [details]
Rewritten solution

Look at this one, it should work similiar to JDT. When there is more than one
proposal, it retrives their's common part (from the beggining) and creates the
proposal.
Comment 9 Alain Magloire CLA 2004-12-17 14:23:20 EST
> Look at this one, it should work similiar to JDT. When there is more than one
> proposal, it retrives their's common part (from the beggining) and creates 
the
proposal.

sigh .. I did and I was applying the patch and doing some changes to the
Code Assist preference page ... when I discovered it was already
supportted within the JFace ContentAssist
Take a look at Jface
   ContentAssit.enablePrefixCompletion();
So basically this is done for us.
I hope this does not stop you from sending improvements in the UI 8-(

Comment 10 John Camelon CLA 2004-12-21 14:25:16 EST
Should this bug be closed then?
Comment 11 Alain Magloire CLA 2004-12-21 15:03:18 EST
> Should this bug be closed then?

Not yet, since we do not have any preference page to toggle this on/off.
See for similarity:
Preferences -> Java -> Editor -> Code Assist -> "Insert common prefixes .."

I would like to "move out" the Code Assist Tab into is own preference
page.  There are a few reasons to this:
- comply with Eclipse-3.1 UI
- Improve performance(i.e. the Code Assist page does not have
  to be instanciate all the time if you did not choose it)
- better UI (??)

I'm looking at doing this currently, but been preempted ... sigh.
Comment 12 Tomaszewski Przemek CLA 2005-01-17 09:01:38 EST
I have implemented removing duplicated completions (see attachment).
Comment 13 Tomaszewski Przemek CLA 2005-01-17 09:02:42 EST
Created attachment 17195 [details]
It removes repeated completions.
Comment 14 Tomaszewski Przemek CLA 2005-01-18 03:27:07 EST
Created attachment 17233 [details]
Replacement ArrayList with Vector

Previous patch puts all completions into ArrayList (as it has been before),
I've changed it into Vector because all repeating completions has been removed
from ArrayList (this list searches all elements and removes all which match the
pattern), and from Vector are not. I've not found any annoying loose of time
due to synchronization usage by Vector.
Comment 15 Alain Magloire CLA 2005-01-19 19:42:56 EST
Ha yes !!
It is a good thing you remind me of this.
The real problem is that we(I) did not have time to
make this visible so a user can turn this on/off via a preference page.
In Eclipse-3.1 we can turn on this behaviour on the CompletionProcessor.

The delay is that I'm bug down with CDT-2.1.1 issues and to get
the UI right, we would need to move the "Code Assist" tab in its own
preference page ... we'll get to it.
Comment 16 Alain Magloire CLA 2005-01-20 17:15:44 EST
Patch applied from PR 82964.
I will keep the PR open to deal with the UI issue.

Still make sure is the patch is ok after update from the repository.

Comment 17 Tomaszewski Przemek CLA 2005-01-21 01:04:32 EST
Patch applied from PR 82964 - great, thanks.
Comment 18 Alain Magloire CLA 2005-01-29 23:39:22 EST
> I will keep the PR open to deal with the UI issue.

Fixed.
The Code Assist settings been move out of the CEditorPreferencPage.
And the new CodeAssist Preference Page contains a new checkbox:

"insert common prefixes automatically"

It is on by default.  The original patch was not necessary, the work
was already implemented in JFace.

Please turn to Verify, when you have chance to check things out.