I am trying to understand how code generator doGenerate invokes. I took an example Xtext Project without any custom changes (only Greetings). By Default code generator looks like this:
override void doGenerate(Resource resource, IFileSystemAccess2 fsa, IGeneratorContext context) {
fsa.generateFile('greetings.txt', 'People to greet: ' +
resource.allContents
.filter(Greeting)
.map[name]
.join(', '))
}
After I ran the Generated Eclipse Plug-in and created new Java Project with file in /src with right extention (src.MyDsl). and converted project to xtext nature, I wrote some greetings and saved. But in src-gen I did not see generated file greetings.txt. So Interpreter works but does not save code.
I have found in Question: xtext-dogenerate method is not called that the file, where I want to save code, needs the right file extension (case sensitive) --(done), the project - xtext nature --(done) and build automatically needs to be enabled.
My Question is how can I enable it to use doGenerate Code Generator automatically? So I could see generated code in greetings.txt
you have to make sure
src.MyDsl
looks suspicious in that regards