more code completion fun!

christopher j bottaro cjb at cs.utexas.edu
Fri Mar 9 21:39:24 GMT 2001


On Friday 09 March 2001 07:24, you wrote:
> There is an algorithm by Donald Knuth (yes, the latex guy) that uses a
> finite state machine, which is widely used for problems of this type.
> You either can test for matches while the user writes and complete as soon
> as there is a unique match, or you can give choices before. For both cases
> you need a dictionary of valid words.

yeah, i think determining the dictionary of valid words is the tough part.  
when you hit a delimiting key, the code completion code has to determine if 
the variable/function/method you just typed is visible or declared in the 
scope that the cursor is currently in.  also, it has be able to resolve the 
type of function calls like such:
func1()->//should have a list of members if func1 returns a pointer
#defines and typedefs make it even more interesting (unless kdevelop's class 
parser already picks up this info and stores it in the class store).
also, its questionable whether or not #includes should add classes to the 
class store.  as of now, if you type
#include <qstring.h>
void myclass::method1()	{
  QString str;
  str. //does nothing
}
but if you add qstring.h to your project and it gets parsed by the 
classparser, then typing str. will produce something.

but once we have the dictionary ready when the delimiter key is pressed, then 
i think most modern computers bruteforce it...=)  like everytime you hit a 
key after "->" it will re-search the dictionary for a closer match and 
highlight it in the list box, then once you've typed enough keys to get the 
proper item highlighted, you can hit tab to complete what you've typed and 
the list box disappears.  something like that.

christopher

-
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