The formatter is one of the favourite IDE features of many developers. Always having a consistent code style, never having to worry about tabs, spaces, indentation or alignment is a tremendous help. But have you ever wondered how a formatter works?
With release 2.9, Xtext introduced the world to their new formatter2 API. It allows a formatter to access the text and the node model, as well as the AST. This allows the formatter to have a better understanding of the context, which in turn enables complicated conditional and pattern-aware code formatting.