Author Topic: Complete code (ctrl+space) adds () at the end completed text  (Read 13386 times)

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
The CC (r6200 debugger branch), adds () randomly after the completed text.

Steps:
1. type variable name (var_a, for example)
2. press ctrl + c
3. choose a method in the list
4. press enter
5. sometimes (randomly) CC adds "()" at the end and most of this times the "()" string is unwanted (by me).

Requests:
1. Please make this feature optional
2. You can improve it to kick in only if the cursor is at the end of the line
       => it will not mess with people when they are modifying already written code (changing the name of a method, for example).

(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline thynson

  • Multiple posting newcomer
  • *
  • Posts: 15
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #1 on: May 29, 2010, 12:35:33 pm »
Ctrl+space may switch language input method in Windows of some country, so I don't prefer this.
Maybe Alt+space or others, or as an option in Editor dialog.

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #2 on: June 03, 2010, 03:53:32 pm »
actually it (the string "()" )is added if the item in the suggestion box is a function.


@oBFusCATed

from the your post ,it seems it don't work correctlly. :wink:
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #3 on: June 03, 2010, 06:46:09 pm »
Yes, it does add "()" for class names too, but it is pretty random
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #4 on: June 04, 2010, 02:50:26 am »
Quote
Yes, it does add "()" for class names too, but it is pretty random

for the random.
can you give me some test codes,please?
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #5 on: June 04, 2010, 07:10:07 pm »
No, because it is random...

Most of the times it happens when I copy the function/method declaration from the .h file,
paste it in the .cpp file and type class_name:: (in the middle of the typing I hit ctrl+space to do auto completion)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #6 on: June 09, 2010, 09:33:09 am »
@oBFusCATed
please try to change codes (int CodeCompletion::CodeComplete() in the file codecompletion.cpp) from

Code
if (token->m_TokenKind == tkFunction || token->m_TokenKind == tkConstructor || token->m_TokenKind == tkDestructor)

to

Code
if (token->m_TokenKind == tkFunction)// || token->m_TokenKind == tkConstructor || token->m_TokenKind == tkDestructor)

I hope this can fix your trouble. :D
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #7 on: June 09, 2010, 06:23:22 pm »
blueshake: have you seen this problem on your code or you're just guessing a fix?

p.s. I'm using the debugger branch
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #8 on: June 10, 2010, 04:32:46 am »
yes,I have try it in ccbranch.it work well
for example :

test codes:
Code
class qq
{
   qq() {}
int x;
int y;
};
q|

when you edit in the positon "|", cc give you codecompletion suggestion box, and you press enter,in the before, it wil auto add the "()" ,but now it will not after applied the modifation.

The reason is :

the class name is the same to the class's construtor,when we generate the suggestion list,we think class construtor is funciton,but actually it maybe is class.and that is why you type class ,but the "()" is added automatically.
« Last Edit: June 10, 2010, 06:14:27 am by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #9 on: June 13, 2010, 02:08:39 am »
Requests:
1. Please make this feature optional
I think we need remove this feature.

BTW. The patch based cc branch.

[attachment deleted by admin]
« Last Edit: June 13, 2010, 02:27:37 am by Loaden »

Offline Loaden

  • Lives here!
  • ****
  • Posts: 1014
Re: Complete code (ctrl+space) adds () at the end completed text
« Reply #10 on: June 15, 2010, 09:26:18 am »
> Please make this feature optional

done in cc branch (svn6361) :lol: