1
votes

I have a really strange problem. I'm trying to implement a code generator from my dsl, but the Generator class doesn't get called at all.

The compiler in the runtime instance in the preference page is activated,also build automatically. I tried also to clean the runtime workspace and to create new projects, but without success. In debug mode the method doesn't get called at all.

The binding in the code is done by the generated Abstract*RuntimeModule. Any idea what's the problem? I use Xtext 2.7.2

2

2 Answers

2
votes

the project needs org.eclipse.xtext.ui.shared.xtextNature and org.eclipse.xtext.ui.shared.xtextBuilder. (Have a look at Right-Click Configure menu on the project) You have to Enable Build automatically and the model files should be error free.

Try the following steps

  • create a new Xtext Project with the Wizard
  • Generate the Hello World Language
  • Enable the Code in the Pre-Generated MyDslGenerator.xtend
  • Start a Runtime Eclipse App
  • Create a new General -> Project
  • Create a new File "test.mydsl" in that project (ask yes if asked for nature)
  • Fill it with some contents and save it

You can try to debug in org.eclipse.xtext.builder.BuilderParticipant.handleChangedContents(Delta, IBuildContext, EclipseResourceFileSystemAccess2) and in org.eclipse.xtext.builder.impl.XtextBuilder.doBuild(ToBeBuilt, IProgressMonitor, BuildType)

1
votes

For Googlers, this is the simple solution to the OP's problem:

As the OP mentioned in their final comment to Christian Dietrich's answer, it appears that the file extension is case sensitive when it comes to generating code.

I find this confusing, because it is not case sensitive when creating a file that recognizes the grammar of a DSL.

I'm using XText 2.10.0