Re: [Vala] Vala completion support for vim

Thanks for the help, but I'm still running into some problems. Here's my
first attempt, which tries to parse itself ("program.vala"):

using Afrodite;

MainLoop loop;

void on_begin_parsing(CompletionEngine engine) {



void on_end_parsing(CompletionEngine engine) {



int main() {

loop = new MainLoop();

var engine = new CompletionEngine();




return 0;


This program ends with *** Message: symbolresolver.vala:54: file
program.vala - can't resolve using directive: Afrodite. *I'm assuming this
means that I would have to add libafrodite-0.12.vapi to the engine manually,
but it's installed in the right place, so I shouldn't have to.
If I comment out everything between the creation of the engine and "return
0", then it again exits with a segfault.

I'd be happy to help contribute to afrodite, but it might take me a while to
learn how it works and where it needs improvements. Any help or links to
good resources would be great.

Thanks again,

On Tue, Aug 30, 2011 at 8:32 AM, Andrea Del Signore <sejerpz tin it> wrote:
Hi Serge,

On Mon, 2011-08-29 at 16:15 -0700, Damien Radtke wrote:
Thanks for the suggestion. I began looking into it, but have run into
a couple of problems. I successfully built afrodite from the VTG
source, but ran into some issues when trying to compile a program that
uses it.

A little preface: afrodite is still very unstable and a little bit messy
because lack of time / knowledge in this specific field ;)

Having said that if you want to use it you're welcome and I'll try to
give you support as time permit.

1. First, there's an inconsistency with naming. The installed library
generates afrodite-0.12.vapi for the vala api, but uses
libafrodite-0.12.pc for pkg-config, so if --pkg=libafrodite-0.12 is
used then valac can't find it, but if --pkg=afrodite-0.12 is used,
then the needed cflags and libs aren't included. I had to manually
rename the vapi file to libafrodite-0.12.vapi in order to get it to

That's possible since I use the library with static linking so I can
miss this inconsistency. I'll look at it at fix asap.

2. Even after compilation succeeds, trying to use the library causes
the program to end in a segfault. For example, I have a simple program
that creates a new CodeDom object, and while the object creation
itself doesn't cause the program to crash (print statements placed
afterwards still show up), returning from main then results in a
segmentation fault. Removing the CodeDom object fixes it.

I should see your sample code, but this sound wrong: 'For example, I
have a simple program that creates a new CodeDom object'

You shouldn't create the codedom object directly. See this minimal code:

As you can see:

line 41 a completionengine object is created
line 45 a sourcefile is queued for parsing

The engine parse the file and it builds the codedom.
You can query the codedom see line 63

This is how afrodite works in pratice:

1) you create a completionengine (vala-toys uses one engine for each

2) you submit all the source files / vapi to the engine for parsing and

3) you can query the codedom for all the symbols in scope at a give

4) you can also submit a 'live buffer' (vala-toys does this for the
current edited file)

I would appreciate it if someone could help get these problems solved
so that Vim can get its completion plugin as soon as possible. =)

Please take in mind that there are a lot of bugs to be fixed and please
don't think that I'm satisfied with the current API. Even all about
afrodite is pretty in flux, it works most of the time and here it
doesn't crash to often ;)


Andrea Del Signore

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]