The Layout Preservation Project

Spoofax
We implemented an algorithm for layout preservation in refactorings. The algorithm reconstructs the source code after a transformation on the abstract syntax tree, preserving the layout of the original source code.

The library will be integrated in the Spoofax language workbench in the near future. Until then you can use the library in your Spoofax project by copying the code from subversion:

https://svn.strategoxt.org/repos/StrategoXT/refactoring/lib-reconstruction/