Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 140897

Summary: [content assist] ccode assist proposals incorrect after undo
Product: [Eclipse Project] JDT Reporter: Christopher Daly <cjdaly>
Component: TextAssignee: Tom Hofmann <eclipse>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P2 CC: daniel_megert
Version: 3.2   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Christopher Daly CLA 2006-05-09 15:10:27 EDT
1)create a new class Foo and in the body type "synch" and ctrl-space

the first 3 default proposals are:
synchronized - synchronized block
synchronized
synch() void - method stub

2) hit enter ...
3) oops that wasn't what I wanted, hit ctrl-Z
4) hit ctrl-space again

now the first 3 default proposals are
clone...
equals...
finalize...

5) hit ctrl-space again

first 3 template proposals:
synchronized - synchronized block
do ...
for ...

6) goto 4  (hitting ctrl-space again gives those default proposals)

I really wanted the second choice from the original default proposal list (the "synchronized" keyword) but I never see that again.

Note that pressing right-arrow once and ctrl-space gets me back to the good state.
Comment 1 Dani Megert CLA 2006-05-10 02:03:33 EDT
What's the build id?

Tom, please investigate.
Comment 2 Christopher Daly CLA 2006-05-10 02:21:24 EDT
I'm seeing this on 3.2RC1.  I don't have anything newer downloaded at the moment.
Comment 3 Tom Hofmann CLA 2006-05-10 03:49:45 EDT
This stems from the fact that applying the "synchronized block" proposal replaces the original prefix ("synch"), which means that undo selects the restored prefix. Code assist always works at the start of the selection.

*** This bug has been marked as a duplicate of 103094 ***
Comment 4 Christopher Daly CLA 2006-05-10 04:10:08 EDT
Ahh, I hadn't noticed the change in selection.  I agree this is like bug 103094.

This is certainly not something to delay 3.2, but don't you think the flow is not very nice here?  I do this (initially choose the wrong proposal) all the time when I'm working too fast.

Code assist could use the cursor position or the end of the selection, why use the start of the selection?

And is it a bug that undo doesn't revert to the original selection state? (that would take this out of JDT and over to platform I guess)