Bug 325374 - [content assist] Code assist should be smart enough to remove redundant parenthesis
Summary: [content assist] Code assist should be smart enough to remove redundant paren...
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.6   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Text-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 405275 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-09-15 12:20 EDT by Francis Upton IV CLA
Modified: 2013-04-09 12:02 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 Francis Upton IV CLA 2010-09-15 12:20:41 EDT
If you have code like this:

get()

And then put the cursor after the get and do an autocomplete, selecting getSomething(), you wind up with:

getSomething()()

Which is not what you want.

This can happen a fair amount if you are duplicating code just to change the method names.
Comment 1 Markus Keller CLA 2010-09-15 14:06:42 EDT
This doesn't happen when you have 'Completion overwrites' selected in the preferences (or hold Ctrl while inserting). Unfortunately, the Ctrl-toggling is not available when you have 'Insert single proposals automatically' enabled and Ctrl+Space only finds a single proposal.

Nevertheless, I agree this is a real problem.
Comment 2 Markus Keller CLA 2010-09-15 14:10:10 EDT
Note that there are also scenarios where you do want the additional arguments list, e.g.:
    get|(name)

and you want to change this to:
    getRemote(path, credentials).get(name)

=> in this case the () after getRemote are not empty but contain auto-filled arguments.
Comment 3 Dani Megert CLA 2013-04-09 09:37:48 EDT
*** Bug 405275 has been marked as a duplicate of this bug. ***
Comment 4 Alexis Pautrot CLA 2013-04-09 12:02:33 EDT
Another related bug (bug 405275) : with either 'Completion inserts' or 'Completion overwrite' options activated, code assist inserts redundant parenthesis when a space separates the cursor and its following parenthesis :

get<<CODE ASSIST>> (true);

will insert:

getSomething ( ) (true);

Maybe also related to options of my code formatter, where I'm using settings that put spaces before parenthesis.