Re[3]: [cedet-semantic] code completion for C++

>>> Ville Vainio <ville.vainio@...> seems to think that:
>>>>>> "Eric" == Eric M Ludlam <eric@...> writes:
>
> Eric> The current state of "smart completion" is very early yet.
> Eric> It seems to work well for most basic cases. What it really
> Eric> needs is some sort of high-speed back end for searching
> Eric> through very large symbol tables in a controlled manner.
>
>This would seem like a candidate for a separate project - a "source
>code server" of some sort. One could imagine that someone might take
>the C++ code database stuff out of eclipse and provided it as a
>standalone server which you could instruct to parse source directories
>and ask for completion of symbols...
>
>But it's probably too deeply integrated w/ eclipse to actually be
>worthwhile as a standalone product. It would still be nice for various
>projects though, even ones that don't necessarily need to be source
>code editors.
I'm open to just about any kind of extension. I tried to make the
object system capable of being extended without tweaking semantic
internals. If you can do it, go for it!
Eric
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org

Thread view

Hi,
I'm doing my first steps with semantic 1.4.4 in
GNU-emacs 21.2.1 for C++ editing under linux.
I wrote a small "program" for test purpose:
int main()
{
int aNumber = 1;
aNumber = 3;
return 0;
}
The variable aNumber is completed fine if I call
"semantic-ia-complete-symbol".
However if I extend the code, say:
#include <vector>
int main()
{
int aNumber = 1;
aNumber = 3;
std::vector<int> tmp;
tmp.push_back(1); //not recognized
return 0;
}
The push_back method of the vector id not offered to me.
Message: No smart completion found.
How can I import the C++ standard components under /usr/include/g++
to semantics so that code completion works ?
I also want try to import the whole boost libraries.
I tried:
(setq semanticdb-project-roots
(list "/opt/software/boost_1_30_0"
"/usr/include/g++"
"/home/pberg/test_semantics"))
but that is obviously not enough.
The documentation at http://cedet.sourceforge.net/intellisense.shtml says:
>The next step is to force Emacs to parse all your files into databases.
>Unfortunately, this is currently best done by just visiting all the files you care about,
>and letting semantic parse them.
But how can automate this visiting for a whole directory ?
Thomas
--

Hi,
If you have too many troubles with semantic 1.4.4, I recommend the
latest cedet beta (1.0beta3b) which has betas of semantic 2 in it.
Semantic 1.4 does not have an automated way to visit lots of files.
You can create a keyboard macro to visit all your .c files in a dired
mode though.
Currently, in all released of semantic, it is problematic to get a C
file project too look into system header files, though there is a new
"system" database you can build with a script in semantic 2.0 like
this:
M-x semanticdb-create-system-database RET path/to/sysinclude RET
The problem is that recursing through all the header files can be
very slow... to the point where it is excruciatingly painful, so I
disabled a recursive depth past 1.
In addition, the C parser has some difficulty with more complex
templates. I have no idea if it will be able to handle the boost
libraries which I understand as being quite complex.
The current state of "smart completion" is very early yet. It seems
to work well for most basic cases. What it really needs is some sort
of high-speed back end for searching through very large symbol tables
in a controlled manner.
These are problems that need to be dealt with and are most certainly
on my shorter term todo list.
Eric
>>> Thomas Porschberg <thomas.porschberg@...> seems to think that:
>Hi,
>I'm doing my first steps with semantic 1.4.4 in
>GNU-emacs 21.2.1 for C++ editing under linux.
>
>I wrote a small "program" for test purpose:
>
>int main()
>{
> int aNumber = 1;
> aNumber = 3;
> return 0;
>}
>
>The variable aNumber is completed fine if I call
>"semantic-ia-complete-symbol".
>
>However if I extend the code, say:
>
>#include <vector>
>
>int main()
>{
> int aNumber = 1;
> aNumber = 3;
>
> std::vector<int> tmp;
> tmp.push_back(1); //not recognized
> return 0;
>}
>
>The push_back method of the vector id not offered to me.
>Message: No smart completion found.
>
>How can I import the C++ standard components under /usr/include/g++
>to semantics so that code completion works ?
>I also want try to import the whole boost libraries.
>I tried:
>
>(setq semanticdb-project-roots
> (list "/opt/software/boost_1_30_0"
> "/usr/include/g++"
> "/home/pberg/test_semantics"))
>
>but that is obviously not enough.
>
>The documentation at http://cedet.sourceforge.net/intellisense.shtml says:
>
>>The next step is to force Emacs to parse all your files into databases.
>>Unfortunately, this is currently best done by just visiting all the files you care about,
>>and letting semantic parse them.
>
>But how can automate this visiting for a whole directory ?
>
>Thomas
>
>
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org

>>>>> "Eric" == Eric M Ludlam <eric@...> writes:
Eric> The current state of "smart completion" is very early yet.
Eric> It seems to work well for most basic cases. What it really
Eric> needs is some sort of high-speed back end for searching
Eric> through very large symbol tables in a controlled manner.
This would seem like a candidate for a separate project - a "source
code server" of some sort. One could imagine that someone might take
the C++ code database stuff out of eclipse and provided it as a
standalone server which you could instruct to parse source directories
and ask for completion of symbols...
But it's probably too deeply integrated w/ eclipse to actually be
worthwhile as a standalone product. It would still be nice for various
projects though, even ones that don't necessarily need to be source
code editors.
--
Ville Vainio http://tinyurl.com/2prnb

Ville Vainio <ville.vainio@...> writes:
>>>>>> "Eric" == Eric M Ludlam <eric@...> writes:
>
> Eric> The current state of "smart completion" is very early yet.
> Eric> It seems to work well for most basic cases. What it really
> Eric> needs is some sort of high-speed back end for searching
> Eric> through very large symbol tables in a controlled manner.
>
> This would seem like a candidate for a separate project - a "source
> code server" of some sort. One could imagine that someone might take
> the C++ code database stuff out of eclipse and provided it as a
> standalone server which you could instruct to parse source
> directories and ask for completion of symbols...
How good is eclipse at C++ parsing? Is it's database better than
semantic's (other than presumably being faster)? Does it offer enough
information to produce callgraphs, for example?
Source Navigator's another thing worth looking at. Its databases are
Sleepycat databases with a documented schema, and the parsers are
separate programs which could be run independently of the GUI. The
C/C++ parser isn't very hackable, unfortunately; it was generated
using a proprietary parser-generator, IIRC.
A reasonable fairly short term hack is to take the tags that
semanticdb produces and stick them in an SQL database, and write some
functions to query that. I even made a start at that a few months
ago, although I haven't touched it recently. Better would probably be
to add a proper SQL semanticdb backend, and then I imagine everything
in cedet would just work (with my code the query operations were
specially written).
Code's here
<http://www.cenderis.demon.co.uk/archives/bruce-2004/sem/sem--dev/sem--dev--0/patch-10/sem--dev--0--patch-10.tar.gz&gt;,
for what it's worth.
If I were to do it again, I suspect I'd do more what you're
suggesting: write a special server (probably using sqlite for the
database engine). That should be quite a bit more convenient to use.

>>> Ville Vainio <ville.vainio@...> seems to think that:
>>>>>> "Eric" == Eric M Ludlam <eric@...> writes:
>
> Eric> The current state of "smart completion" is very early yet.
> Eric> It seems to work well for most basic cases. What it really
> Eric> needs is some sort of high-speed back end for searching
> Eric> through very large symbol tables in a controlled manner.
>
>This would seem like a candidate for a separate project - a "source
>code server" of some sort. One could imagine that someone might take
>the C++ code database stuff out of eclipse and provided it as a
>standalone server which you could instruct to parse source directories
>and ask for completion of symbols...
>
>But it's probably too deeply integrated w/ eclipse to actually be
>worthwhile as a standalone product. It would still be nice for various
>projects though, even ones that don't necessarily need to be source
>code editors.
I'm open to just about any kind of extension. I tried to make the
object system capable of being extended without tweaking semantic
internals. If you can do it, go for it!
Eric
--
Eric Ludlam: zappo@..., eric@...
Home: http://www.ludlam.net Siege: http://www.siege-engine.com
Emacs: http://cedet.sourceforge.net GNU: http://www.gnu.org