Re: [cedet-semantic] Use GNU GLOBAL DB only for semantic auto-complete
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2010-04-07 15:36:19
|
On 04/07/2010 09:32 AM, Tian Fang wrote: > > > On Tue, Apr 6, 2010 at 10:11 PM, Eric M. Ludlam <er...@si... > <mailto:er...@si...>> wrote: > > On 04/05/2010 10:14 AM, Tian Fang wrote: > > Hi, > > Is there a way to use GNU GLOBAL database pre-generated for > auto-complete? > > In the following example, global DB is pre-generated, which > includes the > structure defined in a.h. Then, in b.c, w/o relying on the "include > a.h", I can still use the global db to auto-complete structure > fields > defined in a.h. > > <root>/a/a.h > <root>/b/b.c > <root>/GLOBAL_DB > > > The Emacs code that comes with GNU Global can do completions w/out > relying on which includes are in a given file. Semantic can also > complete like that, but only on global symbols. It cannot do smart > completion, and derive datatypes of variables to know they are > structures, without relying on header files. > > > [Tian] Glad to hear that Semantic can use only global for completion, > even not a smart one. In this case, how should I config my .emacs? I > already have the following two enabled. But still get "unknown type" > error msg when doing sematic-ia-complete-symbol for a structure field. > > (semanticdb-enable-gnu-global-databases 'c-mode) > (semanticdb-enable-gnu-global-databases 'c++-mode) [...] > If you have GNU Global, Semantic can look up some global symbols > using it. That helps when you are starting in a fresh directory > where Emacs hasn't had a chance to parse all your files yet. There are two kinds of searches. There are searches that search an entire 'project' for a symbol. That is when GNU Global will be used. This kind of search isn't used very often. There are also more narrowly defined searches, that will only pull in the stuff you include. The smart completion system only uses the more narrowly defined searches, so you need to have the structure in a header that is included. To make sure GNU Global is properly enabled, you can run the command: M-x semanticdb-find-test-translate-path to dump out the databases being used. Is GNU Global there, at the end of the list?) It may be that GNU Global doesn't know about the struct either for some reason. I haven't tried you explicit example yet. I can give it a go, but I'm not sure when. Eric |