Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 366046 - [preferences][content assist] Autocomplete in editor
Summary: [preferences][content assist] Autocomplete in editor
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.7.1   Edit
Hardware: PC Windows 7
: P3 trivial (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-08 10:14 EST by trebor86 CLA
Modified: 2011-12-09 08:11 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 trebor86 CLA 2011-12-08 10:14:12 EST
There's an annoying thing about autocompleting method names in eclipse editor. Lets say we have methods like:
someobject.methodOne();
someobject.methodTwo();
someobject.methodTwenty();

When we hit ctrl+space somewhere at the 'method' word we will be given a list of available method names (all three methods). BUT if we hit the same key combination on word 'One' it will autocomplete the method name (cause there is only one method starting lets say on 'methodO'). What does it mean? If we want to check list of available method names starting on 'methodO' and are unlucky to have only one result it will autocomplete the name even if its already shown (e.g. we will get 'someobject.methodOnene();' - which is VERY annoying). It should ALWAYS list available method names (starting at a certain carret point) and do not autocomplete if the method name is the only result and is already shown (alternatively it could move carret to a place where we pass vars). So ... the result should be as follows:
someobject.methodO<ctrl+space>ne();
>>
someobject.methodOne(<carret_position>); 


-- Configuration Details --
Product: Eclipse 1.4.1.20110909-0613 (org.eclipse.epp.package.java.product)
Installed Features:
 org.eclipse.platform 3.7.1.r37x_v20110729-9gF7UHOxFtniV7mI3T556iZN9AU8bEZ1lHMcVK
Comment 1 Dani Megert CLA 2011-12-08 10:40:24 EST
This can be configured on the 'Content Assist' preference page.
Comment 2 trebor86 CLA 2011-12-09 05:05:03 EST
Do you mean 'Insert single proposals automatically' option? That doesn't solve the problem I've described. It's a great option but it works bad. It breaks the method name when hitting 'ctrl+space' combination on an already written method name when there is only one proposal. Instead it should act as I described before. See the example in my description.
Comment 3 Dani Megert CLA 2011-12-09 05:19:36 EST
(In reply to comment #2)
> Do you mean 'Insert single proposals automatically' option?
Yes.

> That doesn't solve
> the problem I've described. It's a great option but it works bad. It breaks the
> method name when hitting 'ctrl+space' combination on an already written method
> name when there is only one proposal.
No, it shouldn't if the option is disabled. If that's not the case for you, then please provide a full step by step example.

There is one caveat: content assist always uses the left side of the selection to trigger the completion i.e. if you select "one", then it will trigger it as if the caret would be before 'o'.
Comment 4 trebor86 CLA 2011-12-09 07:47:54 EST
It's not about disabling 'Insert single proposals automatically' 'cause it's very usefull. Here's what I mean:

Lengend:
<cs> - ctrl + space hit
<cp> - carret possition
>> - result of an action

Available methods:
ob.methodOne();
ob.methodTwo();
ob.methodThree();

Example 1. Usefull side of the option [while writting method name]
ob.methodO<cs>       >>	      ob.methodOne()<cp>

Example 2. [method name already written]
ob.methodTwo(); //now we want to check if there are any other methods starting at 'methodT' so ...
ob.methodT<cs>wo(); //we click at this position and as a result we get a window with all the method names starting at 'methodT'

BUT 

Example 3.[method name already written]
ob.methodO<cs>ne(); //we now check if there are any methods starting at 'methodO'
ob.methodO<cs>ne();  >>   ob.methodOne()<cp>ne();  //which isn't neccecarily what we wanted to achieve (we only wanted to check the names of other methods)

HOW imo it should look like?:

Example 3.1
ob.methodO<cs>ne();  //should show a window with a method description (the same as in Example 2, but only methodOne() listed)

Hope it describes what I mean. Regards
Comment 5 Dani Megert CLA 2011-12-09 08:11:54 EST
OK, I see what you mean. It's something in the middle of the current option. I think this is overkill.

Note that if you choose that completion overwrites, you won't end up with garbage.