clang indexing server for emacs?

Hey Guys,
    i was surprised to see a couple of days back that a piece of complicated software that i work on was fully compilable by cclang. What i was more enthusiastic about was that there were some tiny little scripts for emacs which would present completion options using cclangs --completion-at instruction. It was able to prove that cclang is ready (or close to be ready) for prime time.

I have a question and a suggestion:
Is anyone writing a full fledged backend indexing server for emacs and other editors? I see that its possible to provide a very powerful indexing services to editors using cclang.

We could have a simple service that listens on a custom protocol supporting commands like:
1. Load Project:
    a. sets up std header locations
    b. sets up project specific header locations etc

2. Now editing:
    a. Loads up the current state of the file and returns back a list of classes defined and functions in each etc.
    b. precompiles all headers being used for responding back immediately on this file in future.
    b. a subcommand of "Get Completion" would return completion on this file using precompiled headers.
    d. Get classes, functions, uml associations etc etc etc..

3. Close project etc.

I am very excited as it now gives us a chance to use emacs the way eclipse and other editors have been used (with more intelligence). There was a project called XRef which was usable but it doesnt have gnu compatible compiler backend (or atleast discontinued a while ago and cannot compile boost).

Now you might ask me if i have all these ideas why dont i pick it up?
Well, honestly i have a full time job and a part time course thats going to keep me a lot busy for next 1 year and thats why i asked. I would be very interested in mentoring if someone is able to take this up as a uni project or something.


no replies??

I'm guessing that most readers of the list had the same reaction I did: it sounds like a great idea, but unless you're planning to work on this, or someone is already working on this, there's nothing we say. It's fairly rare in the open source world for someone to read another persons's idea and go off to implement such a major feature.

  - Doug

Thanks Doug for clearing up.. So basically am on my own :wink:

<> writes:

Thanks Doug for clearing up.. So basically am on my own :wink:

In the sense that it's quite possible that nobody's working on something
similar, sure. However, once you've got something that shows promise
I'm sure you'll get interest. It's not a million miles away from eclim
(vim using eclipse as a server), for example, so people who dislike
eclipse but like the general idea might well be interested.


Actually I am working on something similar.
I started integrating clang code-completion in the IDE that I have
developed and grown quite mature (open source, cross platform

However, currently it is used *inside* the IDE and not as an external
service. But 'extracting' it should be an easy task.

The current state of the 'completion' is that is capable of providing
a completion list by executing clang from the command line. I am at a
point right now where I am implementing the cache based on the
pre-compiled header:
When a file is opened inside the editor, I am extracting all the
include statements from the file and forming a 'pre-compiled' header
which is being compiled in the background.
This file is then used with clang with the '-include-pch' switch to
boost the completion speed.

It looks promising (talking speed wise), but still a bit slower than
the current code completion - but I think its worth the effort.

Developing a custom protocol is an easy task (I already got all the
infrastructure required for this (Windows Named pipe/Domain Sockets
The only thing I am not sure that I can get from the 'clang' atm
(*without* linking against libclang) is the location of the match

If I had the location, of the match, I could also parse any doxy
comment on top of that method and return it along with the match (this
is how the current code completion works)

Any ideas whether this is feasible? or must I link against libclang?