Summary: | Completion improvement. | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | [Tools] CDT | Reporter: | Tomaszewski Przemek <tomaszewski.p> | ||||||||||
Component: | cdt-core | Assignee: | Alain Magloire <alain> | ||||||||||
Status: | RESOLVED FIXED | QA Contact: | |||||||||||
Severity: | enhancement | ||||||||||||
Priority: | P3 | CC: | john.camelon | ||||||||||
Version: | 3.0 | Keywords: | contributed | ||||||||||
Target Milestone: | 3.0 | ||||||||||||
Hardware: | All | ||||||||||||
OS: | All | ||||||||||||
Whiteboard: | |||||||||||||
Attachments: |
|
Description
Tomaszewski Przemek
2004-12-16 10:05:22 EST
Created attachment 16695 [details]
Adds the improvement.
Please explain what a "fast completion" is? 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. > 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.
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 ? 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 ? 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. 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.
> 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-(
Should this bug be closed then? > 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.
I have implemented removing duplicated completions (see attachment). Created attachment 17195 [details]
It removes repeated completions.
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.
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. 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. Patch applied from PR 82964 - great, thanks. > 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.
|