[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Using Syntastic and YouCompleteMe on the Subversion Source

From: Ben Reser <ben_at_reser.org>
Date: Fri, 26 Apr 2013 13:09:34 -0700

I'm not sure how many vim users there are around here besides me, as I
recall there was an awful lot of Emacs users out there. However, I
got tired of seeing my compiler warnings caught by other people after
I'd committed.

So two fairly useful plugins for vim are:
Syntastic (syntax checking): https://github.com/scrooloose/syntastic
YouCompleteMe (code-completion): https://github.com/Valloric/YouCompleteMe

In both cases in order to work properly they need to be able to know
how to compile the source file to work properly. Usually this means a
bunch of work extracting the right info from the build system.
However YouCompleteMe supports using the clang compilation database:
http://clang.llvm.org/docs/JSONCompilationDatabase.html

Unfortunately, the best way to produce a clang compilation database is
with CMake, which we don't use. However, there is another option.
Bear:
https://github.com/rizsotto/Bear

Bear hooks into any build system by hooking the exec*() function calls
and detecting the build flags. From that it builds the JSON file that
the clang system can read. Which can then be used to know how to
compile the system.

The mainline of Bear doesn't have working OS X support (yet), but you
can find it ported for OS X here (you'll need to use the
porting_to_osx branch):
https://github.com/breser/Bear/tree/porting_to_osx

I've added the needed .ycm_extra_conf.py and a make target to produce
the compilation database in r1476374. So using these plugins with the
Subversion code base should be as simple as installing the plugins
into vim per their directions, installing bear, running make clean &&
make compile-commands.
Received on 2013-04-26 22:10:12 CEST

This is an archived mail posted to the Subversion Dev mailing list.