Bug 483517 - [content assist] colon key should insert selected proposal for method reference ::
Summary: [content assist] colon key should insert selected proposal for method referen...
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 7
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 483515
Blocks:
  Show dependency tree
 
Reported: 2015-12-02 14:54 EST by Markus Keller CLA
Modified: 2016-01-11 18:36 EST (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 Markus Keller CLA 2015-12-02 14:54:43 EST
Content assist for method references misses the equivalent of the "insert on ." feature that is available for method invocations.

Example: Invoke Content Assist after "StringBu": 

    new Random(0).ints(5, 'a', 'z' + 1).collect(StringBu, null, null);

You can select a proposal and then press the "." key to
- insert the proposal
- insert the .
- open Content Assist after the .

We should have similar support to write method reference completions: When you press the ":" key while a proposal is selected
- insert the proposal
- insert the :
- ... nice magic happens ...

The third step is not so clear in case of method references, because you actually need two colons to proceed. Currently, the proposals after a single colon are wrong, see bug 483515.

If bug 483515 can be fixed so that proposals already appear after a single ":", then the only thing left for JDT Text is to make sure that the proposals insert the second colon as well if it's not already there.

Otherwise, we may consider entering "::" when the user types a single ":". But that would need some more magic to ensure that we don't end up with ":::" when the user types the second ":".

Also check cases when ":" is configured as an auto-activation trigger for Content Assist.
Comment 1 Markus Keller CLA 2016-01-08 16:11:59 EST
(In reply to Markus Keller from comment #0)
> Also check cases when ":" is configured as an auto-activation trigger for
> Content Assist.

I tried that and ran into problems because ":" is also used in conditional expressions. The auto-activation trigger after such a ":" doesn't make sense. It's as annoying as the auto-activation trigger after the last "." in a varargs type declaration. As shown in bug 483515 comment 1, there's no easy check to find if a ":" is actually part of a method reference expression or not.

We probably won't ever be able to suggest ":" as an auto-activation trigger, but we should still support it as a completion trigger for type name proposals.