Bug 31427 - [content assist] code assist inserts wrong item
Summary: [content assist] code assist inserts wrong item
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 2.1   Edit
Hardware: Macintosh Mac OS X - Carbon (unsup.)
: P3 normal with 1 vote (vote)
Target Milestone: 3.1.1   Edit
Assignee: Platform-Text-Inbox CLA Friend
QA Contact:
URL:
Whiteboard:
Keywords:
: 76444 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-02-09 15:47 EST by Evan T CLA Friend
Modified: 2017-08-28 12:28 EDT (History)
3 users (show)

See Also:


Attachments
CompletionProposalPopup.java.diff (3.49 KB, patch)
2005-08-05 03:34 EDT, Tom Hofmann CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Evan T CLA Friend 2003-02-09 15:47:08 EST
I'm having a problem with the Java code assist inserting the wrong value into the editor.
Here's an example of my problem:  Let's say I have an Object o.  I'll type "o." and pause for a
half a second to think and the code assist comes up.  If I were going to choose the notify method, I keep on typing "notify(".  Once I type that "(", the code assist will insert the currently selected item in the list.  Unfortunately, the editor does not seem to be able to keep up with me and the currently selected item was still "equals", so my "o.notify(" becomes "o.equals()".

The same thing happens when I type in a partial method name and press "Enter".  So if I were to type "noti<enter>", instead of selecting notify, Eclipse selects "equals".
Comment 1 Dirk Baeumer CLA Friend 2003-02-09 17:50:37 EST
Andre, can you please have a look. Please move back if there is anything JDT/UI 
can do. 
Comment 2 Andre Weinand CLA Friend 2003-02-12 13:17:58 EST
I couldn't reproduce the problem on my 800MHz PB G4,
however, I talked to Kai, and he thinks that it is possible that the opening parenthesis (or 
the Enter key) trigger an insertion that has not yet been completely filtered.

Moving to Platform/Text
Comment 3 Dani Megert CLA Friend 2004-11-02 05:49:03 EST
*** Bug 76444 has been marked as a duplicate of this bug. ***
Comment 4 web CLA Friend 2004-11-02 08:55:19 EST
Please take a look at this.  It makes the code-assist almost impossible to use.
 I can verify that it happens to me and a friend of mine, both of us on Mac OS X.
Comment 5 Dani Megert CLA Friend 2004-12-22 03:33:07 EST
We cannot reproduce this. To you still see this using 3.1 M4? If so, do you have
additional info that could help?
Comment 6 web CLA Friend 2004-12-22 05:12:37 EST
I'm still seeing this in 3.1 M4.  I have my code assist delay set to 0 (the only
preference I changed).  If I, for example, type, "System.out.", I end up with
"System.class." instead.  If I have a local reference of type Object named o,
and I type "o.n<ctrl-space>", I end up with "o.equals()".  In this second case,
the ".", "n", and ctrl-space must all be typed in very rapid succession; I see
the completion menu briefly, but perhaps it is never populated.  If I type the
".", pause, and then type the "n" and ctrl-space in quick succession, I get the
correct "o.notify".

I'm using Mac OS X (10.3) on an iBook.

Please reopen this bug; it makes it extremely difficult to use code assist.
Comment 7 Dani Megert CLA Friend 2004-12-22 05:28:59 EST
Evan, did you also set auto activation delay to 0?
André can you try this out on the Mac with auto activation delay set to 0?
Comment 8 web CLA Friend 2004-12-22 06:28:52 EST
Hmm.  I see the same bug with my code-assist delay set to 1, 10, or 100, and
those settings may make it easier to reproduce.  

I also see the same bug if I type "o.n<space>", in which case I end up with
"o.equals( )".
Comment 9 Tom Hofmann CLA Friend 2005-06-20 05:47:54 EDT
Andre showed me the effect on the Mac. 

This usually happens if code assist (filtering) is slow, for example after
starting up where jar loading is triggered by content assist.

In order to consistenly reproduce the case, comment out the filter runnable in
CompletionProposalPopup.filterProposals. After doing this, no filtering
whatsoever will occur (also on other platforms).

A possible solution would be to validate a proposal before inserting it.
Comment 10 Tom Hofmann CLA Friend 2005-06-20 05:50:45 EDT
The reason why the filtering does not occur is that the Display's async queue is
flooded, so that the filtering runnables never get executed.
Comment 11 Tom Hofmann CLA Friend 2005-07-22 11:24:09 EDT
fixed > 20050722

CompletionProposalPopup now ensures that any pending filter runnable has
executed before inserting a proposal.
Comment 12 Tom Hofmann CLA Friend 2005-08-04 06:52:01 EDT
possible 3.1.1 candidate?
Comment 13 Andre Weinand CLA Friend 2005-08-04 06:54:55 EDT
+1
Comment 14 Dani Megert CLA Friend 2005-08-04 06:55:49 EDT
Yes. Will look at the needed changes and then decide.
Comment 15 Tom Hofmann CLA Friend 2005-08-05 03:34:06 EDT
Created attachment 25736 [details]
CompletionProposalPopup.java.diff

Patch against R3_1 of CompletionProposalPopup.java

The patch moves the filtering runnable to a field and keeps track of whether a
filtering operation is pending or not. This way, the filter runnable can be run
directly in getSelectedProposal in the case that the posted runnable is stuck
in the async exec queue.
Comment 16 Dani Megert CLA Friend 2005-08-05 10:31:13 EDT
Approving patch with a minor change: added code to prevent running the runnable
a second time after returning the proposals.

Committed fix to R3_1_maintenance.

André please verify the fix either directly in the branch or in the next M-build.
Comment 17 Dirk Baeumer CLA Friend 2005-08-09 04:43:49 EDT
Start verifying...
Comment 18 Dirk Baeumer CLA Friend 2005-08-09 05:09:24 EDT
Can't verify since this is a Mac specific problem and I don't have a Mac.
Comment 19 Andre Weinand CLA Friend 2005-08-09 05:12:34 EDT
I've verified that this bug no longer occurs on Mac.