Hello Everyone,
I am creating a text file from a semantic model, that i create programatically via serialization.
Now I would like to attatch comments to some elements of the semantic model and would like to find these as single line comments above the textual representation of the semantic element.
This example should elaborate my use case:
Consider this file for the greetings dsl
Hello Christian!
Hello Sebastian!
Hello Lukas!
def addCommentsToGreeting(Resource greetingDslResource)
val Model = greetingDslResource.allContents.head as Model
model.greetings.forEach[elem|
elem.addComment('This is a greeting')
]
greetingDslResource.save(null)
The resulting file should look like this
//This is a greeting
Hello Christian!
//This is a greeting
Hello Sebastian!
//This is a greeting
Hello Lukas!
If this cant be done while serializing it would also be interesting to add comments using the formatter.
i would prefere not to unhide the comments in the grammar.
Is there a way to achieve that?
Thanks in advance for your help.