| Summary: | Context's expected type does not consider method return | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Stefan Henss <stefan.henss> |
| Component: | Recommenders | Assignee: | Marcel Bruch <marcel.bruch> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
Added logic to handle completion on method returns. Could you please check with latest head and update this status to reopen or verify? getExpectedType() works for me, thanks. I'm reopening this issue for two reasons: - This might be a bug: context.expectsReturnValue() is still "false" in the given code example, but getExpectedType() works, as mentioned. - To discuss: Should we always disable templates completion when a return type is expected? One-liners would not make much sense, I guess. Here the user should go with the other proposals. But what about verifying that the last method in a pattern is returning this value and placing the whole pattern in front of the return? For example: Button b = new Button(null, 0); return b.<^Space>; ----> Button b = new Button(null, 0); b.doThis(); b.doThat(); return b.getText(); (In reply to comment #2) > - This might be a bug: context.expectsReturnValue() is still "false" in the > given code example, but getExpectedType() works, as mentioned. Agreed. Fixed in master. > - To discuss: Should we always disable templates completion when a return type > is expected? [...] > > Button b = new Button(null, 0); > return b.<^Space>; > > ----> > > Button b = new Button(null, 0); > b.doThis(); > b.doThat(); > return b.getText(); Frankly, I think this is by far more than I would expect as a developer because it gets quite challenging if more than one local may be returned (you may have to pick one of two string values for instance). I wouldn't implement this. In addition I think, one-liners are handled by standard completion quite well and in the case we have a series of calls to execute we have chain completion now. I'm good w/o having this very advanced completion feature. Setting to fixed again and waiting for your verification. Closing this issue. Please give latest dev build (v0.5) a try: http://download.eclipse.org/recommenders/updates/dev/e37/ http://download.eclipse.org/recommenders/updates/dev/e42/ Closing this issue. Please give latest dev build (v0.5) a try: http://download.eclipse.org/recommenders/updates/dev/e37/ http://download.eclipse.org/recommenders/updates/dev/e42/ |
public String completionOnReturn() { Button b = new Button(null, 0); return b.<^Space>; } IntelligentCompletionContext.getExpectedType() gives null in this occasion.