code completion help...

Oliver Strutynski olistrut at gmx.de
Wed Feb 14 22:12:27 GMT 2001


> I know a parser that seems to be complete and written using Qt-classes. You
> might want to have a look at doxygen (http://www.doxygen.org). This is a
> documentation generator as kdoc is. It knows all relevant properties of a
> class and its members (inline/virtual/private/const/...) and it can handle
> namespaces properly. 

I am not sure about this, but as far as I know doxygen is not able to create 
a fully referenced sourcecode. It merely parses definitions and perhaps some 
simple uses (correct me if I'm wrong) but there is much more you need to know 
for a working code completion. (Consider a user typing something like 
a(function1(), function2(1))->m and waiting for the code completion with two 
visible definitions of method "a" with different sets of parameters and 
possibly multiple definitions of the functions used as parameters as well.) 
Also don't forget type conversion necessary for resolving ambiguities between 
multiple definitions, template classes / functions, inheritance...

Some more thoughts:

I worked for a company building a hypertext source repository and we managed 
to completely (well, almost) parse Java source files, but C++ seemed much 
much harder.

Concerning #includes: You might want to consider not to expand includes but 
rather create a database of symbols for all header files needed and only 
update when necessary. This was a rather good solution for parsing Java and 
it might speed up C++ parsing as well. (Again that was easier for Java since 
imported files cannot mix in code as in C/C++.)

One more thing to consider about include files: If you expand includes 
(probably using GCC) you need to have a way to sort of reverse this expansion 
to jump to a definition. Example:

#include "a.h"
#include "b.h"
#include "c.h"

typename varname;

Then if you want to jump to the definition of varname you have to jump to 
line 5. However in the expanded source it might be line 1005 or whatever. You 
can resolve this with the information from the preprocessor output, but it's 
one more thing to keep in mind and it adds some additional complexity.


Oliver


-- 
_____________________________________________________________________
 Oliver Strutynski                                olistrut at iname.com

-
to unsubscribe from this list send an email to kdevelop-request at kdevelop.org with the following body:
unsubscribe »your-email-address«



More information about the KDevelop mailing list