Bug 517410 - [content assist] proposal should not override valid typed text
Summary: [content assist] proposal should not override valid typed text
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2017-05-30 03:42 EDT by Albert Hofkamp CLA
Modified: 2019-08-08 08:05 EDT (History)
5 users (show)

See Also:


Attachments
Video showing problematic auto completion (2.28 MB, video/quicktime)
2019-08-07 15:04 EDT, Wallace Mann CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Hofkamp CLA 2017-05-30 03:42:06 EDT
Eclipse modeling, Neon.1
Type

    String s;
    s.|equals(

(At "|" hit ctrl+space for auto-completion proposals, then continue typing)

This gets me

    s.contentEquals(

which is not what I typed. Since "s.equals(" is valid code I would expect the assist to leave my text alone.
Comment 1 Stephan Herrmann CLA 2017-05-30 04:55:32 EDT
Quite annoying, I agree.

Actually looks exactly like 
 - bug 481752 comment 11 
 - bug 483511 comment 2

But all these are supposed to be resolved in Neon, see also bug 483895 and bug 487668

Just to rule out one possible cause, could you please paste the exact versions of plugins org.eclipse.jdt.core and org.eclipse.jdt.ui?
Comment 2 Albert Hofkamp CLA 2017-05-30 05:23:46 EDT
Hmm, theoretically that should be queryable, but no idea how.
I used OSGI console in the end, I hope this is what you need:

osgi> lb org.eclipse.jdt.core
START LEVEL 6
   ID|State      |Level|Name
  553|Active     |    4|Java Development Tools Core (3.12.1.v20160829-0950)
  554|Active     |    4|Java Code Manipulation Functionality (1.7.0.v20160419-0705)

osgi> lb org.eclipse.jdt.ui
START LEVEL 6
   ID|State      |Level|Name
  564|Active     |    4|Java Development Tools UI (3.12.1.v20160822-0645)
Comment 3 Albert Hofkamp CLA 2017-05-30 05:44:10 EDT
Updating my Eclipse doesn't seem to work, it can't find a repo with the correct jgit or egit version, it says. If this is needed, I'd need to download a new eclipse I guess.
Comment 4 Dani Megert CLA 2017-05-30 06:04:49 EDT
(In reply to Stephan Herrmann from comment #1)
> Quite annoying, I agree.

Were you able to reproduce? I'm not, using
http://download.eclipse.org/eclipse/downloads/drops4/S-4.7RC2-201705242000/
Comment 5 Stephan Herrmann CLA 2017-05-30 06:32:56 EDT
(In reply to Dani Megert from comment #4)
> (In reply to Stephan Herrmann from comment #1)
> > Quite annoying, I agree.
> 
> Were you able to reproduce?

No.
(this comment referred just to the bug in general).
Comment 6 Albert Hofkamp CLA 2017-05-30 07:35:08 EDT
I updated to Neon.3 modeling, and the issue is still there.
I also tried the above version with a new work space, new project, new class, and then it works as expected.

This suggests the workspace is breaking things?
Comment 7 Dani Megert CLA 2017-05-30 08:18:33 EDT
(In reply to Albert Hofkamp from comment #6)
> I updated to Neon.3 modeling, and the issue is still there.
> I also tried the above version with a new work space, new project, new
> class, and then it works as expected.
> 
> This suggests the workspace is breaking things?

Not necessarily. I'd have to check, but Modelling might include Code Recommenders. Are you using that?


Can you try your steps using http://download.eclipse.org/eclipse/downloads/drops4/S-4.7RC2-201705242000/ and a fresh workspace? Just to make sure that I don't see the issue because I use different steps.
Comment 8 Albert Hofkamp CLA 2017-05-30 08:51:54 EDT
I never heard of Code Recommenders, so I don't use them consciously :p

I Ran more tests, thinking it might be context-related, and made a self-contained case based on my real code, in 2 classes shown below. Likely still too big, but this was the quickest way to get working.
The example reproduces in Neon.3 modeling.

I also tried your 4.7RC2 and there is works correctly (does not reproduce).

-----------------
public class Event {
  public String name;
}
-----------------
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;

public class X {
    public static Event computeEventSets(Set<Event> supAlphabet, String tickEventName, String observeSuffix, String enableSuffix,
            Set<Event> plantEvents, Set<Event> observeEvents, Map<Event, Event> enableEventMap)
    {
        // Supervisor alphabet should contain a) all plant events, b) all observe events (one for each plant event), and tick event.
        int expectedSize = Math.max(supAlphabet.size() / 2, 1);
        plantEvents = new LinkedHashSet<>(expectedSize);
        observeEvents = new LinkedHashSet<>(expectedSize);
        enableEventMap = new LinkedHashMap<>(expectedSize);

        Map<String, Event> plantEventNames = new LinkedHashMap<>(expectedSize);
        Map<String, Event> observeEventNames = new LinkedHashMap<>(expectedSize);
        Event tickEvent = null;

        for (Event evt : supAlphabet) {
            // Connect tickevent name with the actual event.
            if (evt.name.equals(tickEventName)) {
                tickEvent = evt;
                continue;
            }

//            String s;
//            s.contentEquals(cs) // Reprodcues in Neon.3 modeling
        }


        return tickEvent;
    }
}
Comment 9 Dani Megert CLA 2017-05-30 09:18:26 EDT
> I also tried your 4.7RC2 and there is works correctly (does not reproduce).

Thank you. I am sorry, but we can't do anything if we do not get steps based on one of "our" downloads.

If you can provide steps based on http://download.eclipse.org/eclipse/downloads/drops4/S-4.7RC2-201705242000/ or newer, then please reopen. Sorry.
Comment 10 Albert Hofkamp CLA 2017-05-30 09:21:21 EDT
Ok, thanks for your efforts
Comment 11 Wallace Mann CLA 2019-08-07 15:04:39 EDT
Created attachment 279515 [details]
Video showing problematic auto completion
Comment 12 Wallace Mann CLA 2019-08-07 15:07:00 EDT
I just added a video showing the behavior using Eclipse Version: 2019-03 (4.11.0)
Build id: 20190314-1200.  If you need me to produce a self contained project showing the problem, I'd be happy to do that.

Cheers,
Wallace
Comment 13 Jay Arthanareeswaran CLA 2019-08-08 00:51:17 EDT
(In reply to Wallace Mann from comment #12)
> I just added a video showing the behavior using Eclipse Version: 2019-03
> (4.11.0)
> Build id: 20190314-1200.  If you need me to produce a self contained project
> showing the problem, I'd be happy to do that.

That'd be nice. I don't see this behavior on HEAD. Using a similar example, I see put* appearing nicely at the top.
Comment 14 Stephan Herrmann CLA 2019-08-08 08:05:26 EDT
@Wallace, the above question about installed plug-ins is relevant also for you. So: which Eclipse package did you install? Any additional plug-ins on top?