Bug 481752 - [content assist] Substring completion proposals have bad relevance
Summary: [content assist] Substring completion proposals have bad relevance
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 4.6   Edit
Hardware: All All
: P3 major (vote)
Target Milestone: 4.6 M4   Edit
Assignee: Jay Arthanareeswaran CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 538831 (view as bug list)
Depends on:
Blocks: 350000 488441
  Show dependency tree
 
Reported: 2015-11-09 12:38 EST by Markus Keller CLA
Modified: 2018-09-08 22:43 EDT (History)
10 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2015-11-09 12:38:34 EST
I20151103-0800

In org.eclipse.swt.widgets.TabFolder#_getChildren(), I added this code:

		Control [] directChildren = super._getChildren ();
		int count = di

Content assist at the end (after "= di") gives me an unusable proposals list. The first few entries are all constants from class Widget.

Expected: Same order as when the second line is just "di".
Comment 1 Noopur Gupta CLA 2015-11-09 13:50:18 EST
(In reply to Markus Keller from comment #0)
> I20151103-0800

I20151103-0800 contains only JDT/Core changes for substring completion. JDT/Text changes are available from N20151103-2000.

There was no change done for adjusting the relevance of proposals hence this bug should be valid with N20151103-2000 also. 

I'll check org.eclipse.swt.widgets.TabFolder#_getChildren() for the issue.
Comment 2 Noopur Gupta CLA 2015-11-10 07:54:23 EST
(In reply to Markus Keller from comment #0)
> The first few entries are all constants from class Widget.
> Expected: Same order as when the second line is just "di".

With the given example, we always get constants first in the proposal list, even without substring completion. (Can be seen by disabling "Show substring matches" in Content Assist preferences.)

Now the list looks bad as we have more constants (and methods, that match the token as substring) in the list before the proposal for "directChildren".

We can adjust the relevance such that all kinds of prefix matches are shown before the substring matches. Or, do we have a better solution?
Comment 3 Sebastian Zarnekow CLA 2015-11-10 08:35:41 EST
How's the approach different from code recommenders subword completion? I think they did already stumble upon most of the usability issues and solved them in a decent way.
Comment 4 Markus Keller CLA 2015-11-10 08:36:25 EST
(In reply to Noopur Gupta from comment #2)
I guess without substring matching, we get constants first because they actually are more relevant (their type "int" matches the type of the variable declaration).

Substring matches should always be less relevant than applicable prefix matches. After "int count = di", e.g. the "dispose() : void" proposal can't produce error-free code. I think it would be OK to make substring matches more relevant if their result is assignable in the context.

In cases where the result type of the proposal is not assignable to the context (e.g. "getDisplay() : Display"), substring matches should again be less relevant than prefix matches.

If the relevance is computed in JDT Core, then please move this bug.
Comment 5 Noopur Gupta CLA 2015-11-12 04:04:48 EST
Moving to JDT/Core as the base relevance of proposals is calculated there.
Comment 6 Eclipse Genie CLA 2015-11-16 05:19:32 EST
New Gerrit change created: https://git.eclipse.org/r/60469
Comment 7 Jay Arthanareeswaran CLA 2015-11-16 05:21:19 EST
(In reply to Eclipse Genie from comment #6)
> New Gerrit change created: https://git.eclipse.org/r/60469

This is only a draft and the test changes need a pass over.
Comment 9 Stephan Herrmann CLA 2015-12-06 07:46:49 EST
In I20151201-1100 which contains the fix from comment 8 I see the following bad behavior:


I completely typed all of these characters:

  String.valueOf(currentMethod.selector).equals("foo")

but completion changed this to

  String.copyValueOf(currentMethod.selector).contentEquals("foo")

This is worse than having no completion proposals at all.

I hope this can be fixed by ensuring that a full perfect match always ranks higher than anything else, including substring matches.
Comment 10 Jay Arthanareeswaran CLA 2015-12-07 00:06:20 EST
(In reply to Stephan Herrmann from comment #9)
> In I20151201-1100 which contains the fix from comment 8 I see the following
> bad behavior:
> 
> 
> I completely typed all of these characters:

Stephan, I don't understand. What do you mean by completion changed it? Can you give me a complete use case for my sake? Thanks!
Comment 11 Stephan Herrmann CLA 2015-12-07 10:50:52 EST
Sorry if it wasn't clear.

Let me split into steps:

(1) Type:
    String.valueOf
(2) Type: 
    (
-> Completion inserts to become: 
    String.copyValueOf(|)
(3) Insert argument and continue typing until you have: 
    String.copyValueOf(currentMethod.selector).equals
(4) Type:
    (
-> Completion inserts to become:
    String.copyValueOf(currentMethod.selector).contentEquals(|)

In both cases it picked a proposal that is a worse match than what I had typed up-to that point.

Disclaimer: I didn't even look at the list of proposals, because I was faster by just typing the 6 / 7 chars.
Comment 12 Jay Arthanareeswaran CLA 2015-12-08 01:01:34 EST
(In reply to Stephan Herrmann from comment #9)
> In I20151201-1100 which contains the fix from comment 8 I see the following
> bad behavior:

According to Noopur, this is bug 483511.
Comment 13 Manoj N Palat CLA 2015-12-09 05:18:53 EST
Verification after jdt.ui fix
Comment 14 Marcel Bruch CLA 2015-12-09 05:47:57 EST
Did any change related to relevance computation make it into M4? I'm asking b/c we would need to adjust Recommenders relevance computation as well. Recommenders relevance computation is based on the JDT base relevance but has add-ons for the various subwords matchings. Thank you.
Comment 15 Noopur Gupta CLA 2015-12-09 06:39:24 EST
(In reply to Marcel Bruch from comment #14)
> Did any change related to relevance computation make it into M4?

Yes, see comment #8.
Comment 16 Jay Arthanareeswaran CLA 2015-12-09 07:22:16 EST
(In reply to Noopur Gupta from comment #15)
> (In reply to Marcel Bruch from comment #14)
> > Did any change related to relevance computation make it into M4?
> 
> Yes, see comment #8.

But it may not have any impact as the changes depend on the substringMatch option, which has been disabled for now via bug 483895.
Comment 17 Markus Keller CLA 2015-12-09 13:30:46 EST
Substring completion has been removed for M4, see bug 483895.
Comment 18 Sasikanth Bharadwaj CLA 2016-01-25 01:18:28 EST
Verified for 4.6 M5 using I20160124-2000 build
Comment 19 Martin Grajcar CLA 2018-09-08 22:43:48 EDT
*** Bug 538831 has been marked as a duplicate of this bug. ***