eclipse-jdt / eclipse-jdt/eclipse.jdt.ui

[content assist] Unify template proposals and chain template proposals

Open
#2,128 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Java
Stars
59
Forks
127
Avg merge
22h 47m
Merged PRs (30d)
28

Description

(This originally came from https://bugs.eclipse.org/bugs/show_bug.cgi?id=570577)

Chain template proposals are really useful. In particular often the chain template proposals are more useful than the standard proposals. So I would like to suggest integrating the chain template proposals with the main proposals and to improve the sequence of proposals.

An example:
```
public class ChainTemplateProposal {

public static void main(String[] args) {
Person p;
Country c = p.; // <===
}

interface Person {
String getName();
Address getAddress();
int getAge();
}

interface Address {
String getStreetAddress();
String getZipCode();
Country getCountry();
}

interface Country {
}
}
```
When I type the "p." in the code above I get the following proposals:
```
equals(Object obj)
getAddress()
getAge()
...
```
Then I type CTRL-SPACE 3 (!) times and I get
```
getAddress().getCountry()
```
If I change the defaults and check "Chain Template Proposals" in the preferences (Content Assist -> Advanced) then I get
```
equals(Object obj)
getAddress()
getAge()
... (9 other proposals including 2 notify() and 3 wait() methods with "void" return value)
getAddress().getCountry()
```
I would like

1. Per default integrate Chain Template Proposals in the default content assist list

2. Sort the whole list by the appropriate return value.

Another example. Consider e.g.
```
String x = p.
```
This then shows me the following proposal:
```
getName()
toString()
... (> 10 not-very-useful proposals)
getAddress().getStreetAddress()
getAddress().getZipCode()
getClass().getCanonicalName()
```

The proposals should first show the local methods which return the correct type. Then they should show the chain template proposals for the user-defined classes (this means: JDK methods like getClass() should come later).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.