Bug 9020 - More intelligent code assist
Summary: More intelligent code assist
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 2.1 M4   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-04 09:11 EST by Magnus Ihse Bursie CLA
Modified: 2003-03-17 11:53 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Ihse Bursie CLA 2002-02-04 09:11:01 EST
The code assist could be made more intelligent in a number of way. One way is 
to promote probable expansion in the list, instead of just providing alphabetic 
sort. This could be made by prioritizing types which would be legal code. 
Consider the following code fragment:
String s = new S<code assist>
In this case, I'd like Code Assist to suggest String, not stderr or 
SampleModel. 
If I have this class:
public class FooExtended extends Foo {
  Foo myFoo = new Fo<code assist>
I'd like Code assist to suggest Foo and all subtypes of Foo beginning 
with "Fo", topmost in the list.
Comment 1 Erich Gamma CLA 2002-02-04 17:55:20 EST
Philippe has looked into this. It would require to consider the left hand side 
of the assignment when computing proposals. This is doable, but it is 
problematic in the case of an expression like:
   String s= a.getString()
In this case you want to get the full set of proposals on the right hand side 
of the expression. However, your examples below make we wonder whether the code 
assist engine could handle proposals after new specially. 

Moving to JDT Core for comment.
Comment 2 Philipe Mulet CLA 2002-02-06 07:28:17 EST
No, this wouldn't work either. One could write:

Foo myFoo = new FooFactory().getFooInstance();

The sorting is interesting, and I believe it would require an API change so as 
to give a different answer in the case the left-hand side type is matching the 
return type of the inserted completion...

Need to think about it some more, but what about post 2.0 ?
Comment 3 Philipe Mulet CLA 2002-02-07 07:30:02 EST
Deferring.
Comment 4 Philipe Mulet CLA 2002-07-25 06:59:37 EDT
Reopening
Comment 5 Philipe Mulet CLA 2002-07-25 07:00:55 EDT
Clearing resolution
Comment 6 Olivier Thomann CLA 2002-11-05 16:36:59 EST
Hi David,

I think this should be yours (related to code assist).
Comment 7 David Audel CLA 2002-11-19 06:35:08 EST
These features are in M3(20021115) build.

// String is the first proposal
String s = new S<cursor>

// x2 is the first proposal
int x1
String x2
String s = x<cursor> 

// foo2 is the first proposal
X foo1(){...}
String foo2(){...}
void bar(){
   String s = foo<cursor>
}

Closing.