CPP Code Completion

Oli mr.diggilin at gmail.com
Wed Dec 16 10:49:17 UTC 2009


@David:
W/ regards to code completion:
Currently, whenever an expression is invalid, KDevelop won't provide any 
completions (see context.cpp:555, 573). But consider this case:
Header:
----------
myclass {
  int myfunction()
};
----------
cpp:
----------
//code completion here will offer "myclass" (twice, once from Kate(?) and once
//from KDevelop) and "myclass::myfunction" -- good
mycl 
//code completion here will offer only myclass (from Kate(?)), because the
//expression is "int" instead of empty and thus not valid
int my
----------

I think that it should check if it's a NoMemberAccess, and if it is, even if 
the expression is invalid, it should be allowed to continue.
In my recent patch, I checked if "depth == 0", which didn't have the intended 
effect, but checking for NoMemberAccess instead should be correct (and not only 
for my example case).
In my testing I've found the code completion is noticeably better like this. 
Let me know if there are any problems this would cause.

Another question: Is there a good way to make a test-case execute a completion 
and then test what the context text looks like afterwords? This would be to 
test that my line eraser isn't overstepping it's bounds.

(I accidentally sent this to kdevelop-bugs at kdevelop.org this morning... 
excellent work I know.)

-Olivier JG




More information about the KDevelop-devel mailing list