Code formatting is an opinionated beast. It always has been a matter of taste, and it always will be a matter of taste. This is the reason, why professional formatting tools, such as Eclipse JDT, offer a gazillion number of options. Is ther an easier solution? There are algorithms which learn from the huge mess of data within the internet and we will not be able to learn from structured source Code? In the past two years we showed at EclipseCon, that machine learning can be used to detect our prefered code style and apply it to the code. But what happened than?
Two years ago we started to solve this problem. The Antlr Codebuff project (https://github.com/antlr/codebuff) produced first good results, but it is limited to languages with an ANTLR 4 grammar (http://www.antlr.org/). So I was looking for a language independent solution and presented a Concept based on Deep Learning last year. Now was the time do delvelop a smart solution for a formatter. I developed a neural network with Deeplearning4j (https://deeplearning4j.org/), which is able to learn the structure of source code. It works on the source code itself, so a huge number of programming languages can be formatted without knowledge of the grammar. Afterwards I integrated it testwise in eclipse Xtext as a first prototype.
In this talk, I will explain the problem of formatting and the concept behind my machine learning solution. Afterwards the Deep Learning formatter, which I integrated in Xtext will have a chance to do its work. My goal for this talk is to convince you that writing a formatter manually is not necessary any more.