Bug 486966 - [content assist] Trying to add an ellipsis performs code completion
Summary: [content assist] Trying to add an ellipsis performs code completion
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.6   Edit
Hardware: PC Windows 10
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-01 16:02 EST by Dirk Fauth CLA
Modified: 2024-02-28 15:03 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Fauth CLA 2016-02-01 16:02:17 EST
I'm trying to create a method that contains an ellipsis parameter. But when trying to enter the triple dot, code completion is performed. This results in changing the desired type to a sub-type and not an ellipsis.

Might be related to Bug 478246.
Comment 1 Stephan Herrmann CLA 2016-02-04 18:05:25 EST
(In reply to Dirk Fauth from comment #0)
> I'm trying to create a method that contains an ellipsis parameter. But when
> trying to enter the triple dot, code completion is performed. This results
> in changing the desired type to a sub-type and not an ellipsis.

you mean 'nested type' rather than subtype, right?
Comment 2 Dirk Fauth CLA 2016-02-05 00:15:53 EST
Yes nested type. Sometimes also accessible fields are added, for example if there is no nested type. 

Typing the triple dot almost everytime produces something unwanted.
Comment 3 Dani Megert CLA 2016-02-05 03:34:51 EST
(In reply to Dirk Fauth from comment #0)
> I'm trying to create a method that contains an ellipsis parameter. But when
> trying to enter the triple dot, code completion is performed. This results
> in changing the desired type to a sub-type and not an ellipsis.
> 
> Might be related to Bug 478246.

Please provide a concrete example using plain Eclipse SDK 4.6 M6:
http://download.eclipse.org/eclipse/downloads/drops4/S-4.6M5-201601282000/
Comment 4 Dirk Fauth CLA 2016-02-05 05:10:01 EST
I think M6 is hard to get. ;-)

So I tried with the linked M5 and actually I needed some time to find the setup to reproduce the issue.

First update your preferences to include Java to the auto-completion:
Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced
Check "Java Proposals"

BTW, why are they disabled by default? I would have assumed that Java Proposals are enabled by default for a Java editor. Or do I misunderstand the content assist feature?

Then create a class similar to the following snippet. The key for the reported issue is the public static nested class.

public class Test {

	public InnerTest bar;
	
	public static class InnerTest {
		public String bar;
	}
}

If you now try to create a method in another class that takes Test as ellipsis parameter, you will immediately get Test.InnerTest.. as result.

I assume this is related to activating auto-completion by pressing a . with 0 ms delay.
Comment 5 Dani Megert CLA 2016-02-05 05:42:58 EST
(In reply to Dirk Fauth from comment #4)
> First update your preferences to include Java to the auto-completion:
> Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced
> Check "Java Proposals"
> BTW, why are they disabled by default? I would have assumed that Java
> Proposals are enabled by default for a Java editor. Or do I misunderstand
> the content assist feature?

If you had to do that then you did not use a new workspace and the indicated build. Those are checked by default. But unchecked in the lower (cycling) section.

 
> Then create a class similar to the following snippet. The key for the
> reported issue is the public static nested class.
> 
> public class Test {
> 
> 	public InnerTest bar;
> 	
> 	public static class InnerTest {
> 		public String bar;
> 	}
> }
> 
> If you now try to create a method in another class that takes Test as
> ellipsis parameter, you will immediately get Test.InnerTest.. as result.

I can reproduce it now.


> I assume this is related to activating auto-completion by pressing a . with
> 0 ms delay.

Yes, and the fact that the second dot inserts the proposal. See also bug 348857.
Comment 6 Dirk Fauth CLA 2016-02-05 06:41:06 EST
(In reply to Dani Megert from comment #5)
> (In reply to Dirk Fauth from comment #4)
> > First update your preferences to include Java to the auto-completion:
> > Window -> Preferences -> Java -> Editor -> Content Assist -> Advanced
> > Check "Java Proposals"
> > BTW, why are they disabled by default? I would have assumed that Java
> > Proposals are enabled by default for a Java editor. Or do I misunderstand
> > the content assist feature?
> 
> If you had to do that then you did not use a new workspace and the indicated
> build. Those are checked by default. But unchecked in the lower (cycling)
> section.

I used the indicated build, but indeed an existing workspace. You are right that it is checked using a new workspace.
Comment 7 Eclipse Genie CLA 2019-10-15 08:27:51 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 8 Stephan Herrmann CLA 2019-10-16 15:12:06 EDT
The bug can still be reproduced using the example from comment 4 and then typing somewhere else

   void m(Test...

result is

   void m(Test.InnerTest..)

Not good.

Checking the following option (from bug 348857) can be used to work around the problem:

 [x] Disable insertion triggers except 'Enter'

That option might be worth advertising more widely.
Comment 9 Eclipse Genie CLA 2021-10-06 17:38:22 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 10 Dirk Steinkamp CLA 2022-03-04 18:35:43 EST
Another workaround: press "." then Esc, then ".."

The problem is with the Java Type Proposals. Maybe a workable solution would be to offer as a first proposal "... ellipsis", if content assist is invoked within an argument list and enabled by auto-activation trigger ".".
Comment 11 Stephan Herrmann CLA 2022-03-05 05:18:26 EST
(In reply to Dirk Steinkamp from comment #10)
> Another workaround: press "." then Esc, then ".."
> 
> The problem is with the Java Type Proposals. Maybe a workable solution would
> be to offer as a first proposal "... ellipsis", if content assist is invoked
> within an argument list and enabled by auto-activation trigger ".".

Wouldn't that just change one undesired result to another result that may be undesired as well. I.e., if you intend to type "Test.InnerTest" you would not be able because that sequence of keys would get you "Test... InnerTest", no?

I don't think that the concept of auto-activation including '.' can be repaired in a situation where '.' introduces syntactical ambiguity.

The auto-activation mechanism would need to dive into semantic analysis to decide if what's left of the cursor is ambiguous or not (if ambiguous: don't insert). Doing semantic analysis at this point may be a violation of tool architecture, which would minimally introduce a performance problem.

As a compromise I could imagine that auto-activation could be suppressed withing any parameter list. Perhaps syntactical context-awareness might be achievable.

Any enthusiast for auto-activation interested in giving this idea a try?
Comment 12 Eclipse Genie CLA 2024-02-28 15:03:44 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.