Bug 202599 - [assist] Auto completion just inserts code instead of changing it
Summary: [assist] Auto completion just inserts code instead of changing it
Status: CLOSED DUPLICATE of bug 57460
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-07 05:54 EDT by Michael Stather CLA
Modified: 2013-07-08 08:47 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Stather CLA 2007-09-07 05:54:15 EDT
Build ID:  I20070625-1500

Steps To Reproduce:
1. Declare functions foo() and foz()
2. Type foo(), delete the "foo"
3. Press CTRL+SPACE, select foz and you'll end up with "foz()()"


More information:
The autocompletion could be much more smarter if it would not just insert the statement I chose (including the brackets behind) but to replace only the changed parts. If I press CTRL+SPACE over a function for example and select a different one in the drop-down box the function should be swapped, not inserted, or I'd end up with things like "fofoz()o()"
Comment 1 Martin Aeschlimann CLA 2007-09-12 04:30:03 EDT
JDT.core decides about the replacement length here. It could add the brackets, but the analysis to do so is not easy.
Comment 2 Max Gilead CLA 2013-07-05 10:43:50 EDT
Given how often one sees it perhaps using a brute force solution would be a good stop-gap solution? Brute force as in 'check if the next two characters are "()" and don't insert an extra pair' or 'check if the next two characters are "()" and delete them because we have already inserted an extra ()'.

The someMethod()() problem is so common that I believe it should be handled even if the solution works only for this single special case.
Comment 3 Dani Megert CLA 2013-07-08 08:47:41 EDT

*** This bug has been marked as a duplicate of bug 57460 ***