My editor esv file triggers the editor-complete rule for auto completion, I set it to the following for debugging purposes:


editor-complete =
debug(!"Editor complete: "); fail

Now, when I have:

var t : Task = Task{};
t.

and I do a Ctrl+space I see the following in my Spoofax console, sometimes:

Editor complete: (FieldAccess(Var(""),COMPLETION("")),[2,3,3,1,1,1,1,1,1,0,1,0], ...)

This, of course is not a valid AST. The identifier in a Var (in mobl, because that’s what I’m using it for) cannot be empty. The odd thing is that a second later when I try again, it works just fine.

This has probably something todo with error recovery or the fact that it’s still parsing, but without this working I can never setup ‘.’ as a trigger for auto completion (which I really want), because it will always give me these kind of ASTs.

Submitted by Zef Hemel on 30 March 2010 at 08:33

On 31 March 2010 at 14:16 Lennart Kats commented:

Seems to work fine for me. I always get the FieldAccess(Var(“t”),COMPLETION("")), no matter if I use the trigger or not.

These things tend to be easier to discuss with an example program. Here’s mine:


module simpl

import mobl

entity Task { n : String }

function foo() {
var t : Task = Task{};
t.
}

(Note that it caches the parse results if you try content completion twice on the same source file, so for testing you should probably change it a bit each time.)


On 31 March 2010 at 14:25 Lennart Kats commented:

Actually, I just found something fishy in the caching logic…


On 31 March 2010 at 14:36 Lennart Kats commented:

Fixed in 0.4.2.1.


On 23 March 2011 at 14:56 Tobi Vollebregt tagged completion

Log in to post comments