Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333615

Summary: Code completion inserting () after function name complete needs a user-preference
Product: [Tools] CDT Reporter: timecop
Component: cdt-editorAssignee: Project Inbox <cdt-editor-inbox>
Status: RESOLVED WONTFIX QA Contact: Anton Leherbauer <aleherb+eclipse>
Severity: enhancement    
Priority: P3 CC: cdtdoug, remy.suen, yevshif, zeratul976
Version: 8.0   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description timecop CLA 2011-01-05 20:35:16 EST
Build Identifier: Build id: 20100917-0705

When writing code in CDT editor, consider the following:

void fooBarBaz(int a, int b);
void barBazFoo(void);

int main(void)
{
  // start typing fooBarBaz function name here:
  foo<ctrl+Space>
  // it will auto-fill the entire function, such as
  fooBarBaz() // placing the cursor at the end of )
}

What I'm requesting is a user pref, similar to the "Typing" pref that auto-inserts closing ", ), } etc, to disable this auto-insertion of args.
Completing a function name is fine, but don't touch my parenthesis.

So correct behavior with this pref turned off with previous example would be:
1) type foo+ctrlSpace
2) it completes to fooBarBaz with cursor at the end.


Reproducible: Always

Steps to Reproduce:
1. Install eclipse
2. Install CDT
3. Follow the steps in Description to add a function name with content assist.
Comment 1 Nathan Ridge CLA 2016-12-29 18:40:14 EST
Can you give an example of a situation where a parenthesis isn't desirable?

I can think of two situations:

  - There is already a parenthesis after the cursor.
    This is something we can detect, and not insert the parenthesis
    in that case. 
    Bug 72391 tracks this.

  - You are passing a pointer to the function.
    This is also something we can detect in many cases, and
    not insert the parenthesis.
    Bug 496563 tracks this.

Anything else? I don't think the above two cases are sufficient motivation for a prefernce, since we can figure out the desirable behaviour in most cases.
Comment 2 Nathan Ridge CLA 2017-04-08 15:18:08 EDT
Closing as WONTFIX per comment 1.