0
votes

I am working o a xtext grammar and i am referencing artifacts like this: A: 'A' name=ID; B: 'B' name = ID ':' ref=[A]; So after launching the eclipse runtime with plugin, i can create files with proper extension containing this: A a B b : a Now i want to refer to artifacts from other files as well and it works out of the box: if A a is declared in a.file and B b : a is declared in b.file the editor shows no errors. The auto-compile works fine as well.

However, if i generate the code on my own like this: generator.doGenerate(new ResourceSetImpl().getResource(URI.createURI(path), true), fsa); The reference is not resolved.

Do i have to compile all files in one run? How could i do this?

1

1 Answers

0
votes

The files are usually compiled by an incremental Xtext build in the background as soon as you save it. If you want to trigger the build manually, you have to make sure to use a properly initialized resource set. It can be obtained from the IResourceSetProvider in an Eclipse context. In standalone mode, you can inject a Provider<XtextResourceSet> to get a configured instance.