Re: [cedet-semantic] predictive-mode
Brought to you by:
zappo
From: Toby C. <tob...@dr...> - 2007-06-26 09:42:51
|
As the author of predictive mode, I can make a few comments about this. Firstly, as you'll see from the "Future Improvements" section of the predictive user guide, integration with semantic is on the to-do list. I even discussed it a while ago on this list with Eric. But it's a fairly major undertaking, and I don't have time at the moment to do it. In fact, properly integrating predictive-mode with semantic wouldn't only give UI improvements, but would also enhance the completion process itself, in two ways: 1) Predictive mode stores "dictionaries" of completion candidates in a data structure that is optimised for finding completions of a prefix string, so finding completions is very fast, even in huge dictionaries. (The data structure is basically built on a ternary search tree, but with caching of time-consuming completions in a hash table.) In fact, the data structures are implemented in a separate library, called dict-tree.el, so with a bit of coding it would be possible to use them as a semantic database. This is probably the correct way to start integrating predictive mode with semantic. 2) Completion with predictive mode is...predictive. That is, it learns how often you use each completion, and prioritises them accordingly. This is obviously of most benefit when the number of possible completions is very large (e.g. when completing English words). But this will often be the case in large programming projects too, or languages with huge collections of libraries (Java, PHP...). The predictive user interface is separated off into a completely independent library, called completion-UI. Completion-ui can be used without predictive mode, so the UI benefits can be had without any need for predictive mode itself (though you will of course lose the benefits described above). Using completion-UI with semantic is fairly easy: it just requires a writing a wrapper function around semantic's completion function, in order to pass the list of completion candidates to completion-UI in the required form. (To get it working well, there are a few other things to do...) I believe there's even some code floating around, either the Emacs wiki or the emacs-sources mailing list, that makes a stab at this. If anyone wants to take one of these projects on, I'm happy to answer any questions about the guts of completion-UI, dict-tree.el and predictive mode. The completion-UI integration should be the easiest, followed by using the dict-tree.el data structures as semantic database, leaving full integration of predictive mode as the most difficult. Toby Arne Schmitz wrote: > I just read about predictive-mode [1], and thought it might give some ideas, > too, how to improve on semantic's code completion. Although more from a UI > point of view. > > Arne > > [1] http://www.emacswiki.org/cgi-bin/emacs?PredictiveMode |