code completion help...

Daniel Berlin dberlin at redhat.com
Wed Feb 14 02:14:59 GMT 2001


Roland Krause <rokrau at yahoo.com> writes:

> 
> An even more stupid question :-)
> 
> So what? 

> 
> It parses good enough for a graphical classviewer but not 
> for code completion? 
It barely does that. Try using it to parse STL headers sometime.

> Is it not fast enough or what is the reason for
> that? 

That too.
Most code completion parsers are incremental, because you have enough
work to do in disambiguation, without wanting to have to worry about
the actual parsing time.

One of the only things fast enough that's open source is ctags,
strangely enough.

> Could it not be enhanced with an API that doesnt change much and
> on which the actual code completion could be built. Then the class
> parser can be replaced later. 
Sure, you could do this, but it would be pretty pointless.
It's not the API necessarily, you can cache the information you
need. It's the parsing time and lack of ability to parse some even
non-complex constructs. Realize that code completion requires being
able to determine the scope of the variable you are trying to
complete, then it's type, then lookup the type, and get all the
relevant info, and present it to the user, in less than a second. If
you are looking up  function arguments, it's a bit easier, since you
must have the variable and type already.

You also need to have error recovery that works (which we really
don't).
You have to realize that proper parsing is a very hard task. Both
Borland, and MS, use the same parser as they have in their compiler,
to do it. 
(Borland just happens to have a very fast parser, so they don't do
incremental parsing).


You'd be better off replacing the current parser with ctags, which can
do at least 800k a second, and give you the info you need (with small
modifications).


--Dan

-
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