Custom formatting

If you tried to apply one of the quickfixes we implemented in Chapter 4, Validation, you might have noticed that after the EMF model has changed, the editor immediately reflects this change; however, the resulting textual representation is not well formatted (as shown in the following screenshot, where we applied the quickfix which adds the missing entity FooBar).

Custom formatting

In general, the EMF model representing the AST does not contain any information about the textual representation, that is, all white space characters are not part of the EMF model (after all, the AST is an abstraction of the actual program).

Xtext keeps track of such information ...

Get Implementing Domain-Specific Languages with Xtext and Xtend now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.