Bug 500413 - [content assist] code completion wrong order
Summary: [content assist] code completion wrong order
Status: CLOSED DUPLICATE of bug 495980
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Recommenders (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2016-08-29 07:26 EDT by Marvin Fröhlich CLA
Modified: 2019-07-24 14:36 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marvin Fröhlich CLA 2016-08-29 07:26:49 EDT
Since Mars the code completion also includes items, that not necessarily begin with what I already typed, but contain sub tokens. This is nice. But those starting with what I already typed should be sorted up, which is very likely what I want to be completed.

Code to reproduce:

#####################################
class X
{
    static void setVisible( boolean visible ) {}
    static String getAJAXFooBar_setVisibility() { return ( "" ); }
}

class Y
{
    void main( String[] args )
    {
        X.setVis|
    }
}
#####################################

Having the caret at the pipe's location with code completion active, the getAJAXFooBar_setVisibility() method is included in the list, which is great, but is sorted to the top, which is bad. Much more likely will be the setVisibile() method to be typed and completed.
Comment 1 Marvin Fröhlich CLA 2016-08-29 07:27:44 EDT
The completion engine also doesn't learn at all (never) and doesn't get, that I want the setVisible() method in 99% of cases.
Comment 2 Noopur Gupta CLA 2016-08-29 10:08:18 EDT
I cannot reproduce this with Eclipse Neon 4.6 (I20160606-1100).

#setVisible is proposed at the top in the given example.

Please check with the 4.6 build without any additional plug-ins and provide exact steps and code snippet to reproduce the issue.
Comment 3 Marvin Fröhlich CLA 2016-08-30 03:35:37 EDT
I checked it with a fresh Neon with only Subclipse installed. And it is the same. Though you need to precisely follow these steps.

Create a class A:

#########################
public class A
{
    public void setVisibile( boolean visible )
    {
    }
    
    public String getAJAXResonseCode_setVisibility()
    {
        return ( null );
    }
}
#########################

From somewhere else like a class B next to A type:

new A().setvisi

getAJAXResonseCode_setVisibility() will be first in the list of proposals.

If you hit escape and then CTRL+space to get the proposals back, the order will be different. setVisible will be on top now, which would be correct at least in this small example. So it makes a difference, whether you're typing it from the dot on or you hit CRTL+space.

If you type the V in upper case like this:

new A().setVisi

The order will be correct, too. Shouldn't case only make a difference, if it is the last criterion (and everything else is the same)?
Comment 4 Noopur Gupta CLA 2016-08-30 04:33:39 EDT
I do not see these issues in Eclipse 4.6 downloaded from:
http://download.eclipse.org/eclipse/downloads/drops4/R-4.6-201606061100/

It does not have Subclipse installed.

Please try with the above and let us know if you can reproduce.
Comment 5 Marvin Fröhlich CLA 2016-08-31 07:14:54 EDT
Ok, I tried your build. And the bug indeed isn't there. So I tried to the standard Eclipse build for Java developers with no additional plugins. At first the bug wasn't there. When I enabled Code Recommenders (for Java) extension then wrong sorting showed up.

I fiddled around a bit with the configuration for this extension. And if I untick the "Subwords-completion processor", the sorting is as it should be. Strangely subwords are still included in the list. It's just as expected with this option unticked.

So the bug seems to be in Code Recommenders For Java extension. Should I open a new ticket? Or is it still well suited here?
Comment 6 Noopur Gupta CLA 2016-08-31 08:21:42 EDT
Moving this bug to Code Recommenders.
Comment 7 Andreas Sewe CLA 2016-08-31 09:39:29 EDT
(In reply to Noopur Gupta from comment #6)
> Moving this bug to Code Recommenders.

Thanks, Noopur.

(In reply to Marvin  Fröhlich from comment #3)
> I checked it with a fresh Neon with only Subclipse installed. And it is the
> same. Though you need to precisely follow these steps.
> 
> Create a class A:
> 
> #########################
> public class A
> {
>     public void setVisibile( boolean visible )
>     {
>     }
>     
>     public String getAJAXResonseCode_setVisibility()
>     {
>         return ( null );
>     }
> }
> #########################
> 
> From somewhere else like a class B next to A type:
> 
> new A().setvisi
> 
> getAJAXResonseCode_setVisibility() will be first in the list of proposals.
> 
> If you hit escape and then CTRL+space to get the proposals back, the order
> will be different. setVisible will be on top now, which would be correct at
> least in this small example. So it makes a difference, whether you're typing
> it from the dot on or you hit CRTL+space.

Marvin, thank you for your detailed steps to reproduce, although it still took some interpreting to be able to trigger the bug:

If you type "new().<ctrl+space>setvisi" (with a lowercase V) *then* getAJAXResonseCode_setVisibility will be shown first as soon as enter the 'v' character.

Is this the scenario you had in mind?

If so, then this sounds like Bug 495980, which has been fixed already in Code Recommenders 2.4.2. Indeed, I have just verified that version 2.4.2 doesn't exhibit the above problem anymore.

FYI, Code Recommenders version 2.4.2 will be part of Eclipse Neon.1 in a few weeks. In the meantime, you can install it from our update site [1].

Hope this helps.

[1] <http://download.eclipse.org/recommenders/updates/stable/>

*** This bug has been marked as a duplicate of bug 495980 ***
Comment 8 Marvin Fröhlich CLA 2016-09-01 02:11:37 EDT
Yes, this was exactly my scenario. And the patch indeed fixed the bug. Thanks a lot.

I will try to be more exact in my next bug report. ;-)
Comment 9 Andreas Sewe CLA 2016-09-01 03:03:16 EDT
(In reply to Marvin  Fröhlich from comment #8)
> I will try to be more exact in my next bug report. ;-)

Don't get me wrong. Your bug report enabled me to reproduce in a couple of minutes rather than hours or not at all. That helps a lot, even if some minor details were unclear.

Anyway, glad that we squashed this bug already.