News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Complete code (ctrl+space) adds () at the end completed text

Started by oBFusCATed, May 03, 2010, 03:34:39 PM

Previous topic - Next topic

oBFusCATed

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!]

thynson

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.

blueshake

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?

oBFusCATed

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!]

blueshake

QuoteYes, 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?

oBFusCATed

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!]

blueshake

@oBFusCATed
please try to change codes (int CodeCompletion::CodeComplete() in the file codecompletion.cpp) from

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

to

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?

oBFusCATed

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!]

blueshake

yes,I have try it in ccbranch.it work well
for example :

test codes:

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.
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?

Loaden

Quote from: oBFusCATed on May 03, 2010, 03:34:39 PM
Requests:
1. Please make this feature optional
I think we need remove this feature.

BTW. The patch based cc branch.

[attachment deleted by admin]

Loaden

> Please make this feature optional

done in cc branch (svn6361) :lol: