You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: gsoc/2017.md
+18Lines changed: 18 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -184,6 +184,24 @@ the JVM) and web-based visualization libraries such as d3.
184
184
185
185
Supervised by [@julienrf](https://github.com/julienrf)
186
186
187
+
### New line-wrapping algorithm for scalafmt
188
+
189
+
[Scalafmt](https://olafurpg.github.io/scalafmt/) is a code formatter for Scala.
190
+
A key feature of scalafmt is that users can define a maximum width (for example 80 characters)
191
+
so that long code lines get automatically wrapped into shorter lines.
192
+
Currently, scalafmt uses a [token-based best-first search algorithm](https://geirsson.com/assets/olafur.geirsson-scalafmt-thesis.pdf) to wrap long lines.
193
+
Both [dartfmt](http://journal.stuffwithstuff.com/2015/09/08/the-hardest-program-ive-ever-written/)
194
+
and [clang-format](https://www.youtube.com/watch?v=s7JmdCfI__c) use a similar approach.
195
+
This token-based best-first algorithm has [known issues](https://olafurpg.github.io/scalafmt/#Deeplynestedcode) in scalafmt.
196
+
197
+
The goal of this project would be to explore and implement an alternative line wrapping algorithm for scalafmt.
198
+
One promising alternative is the [dynamic-programming algorithm employed by rfmt](https://www.researchgate.net/profile/Phillip_Yelland/publication/284724851_A_New_Approach_to_Optimal_Code_Formatting/links/5657f1e608ae4988a7b58558.pdf)
199
+
(see [Python implementation](https://github.com/google/rfmt)).
200
+
Another promising algorithm is Philip Wadler's ["prettier printer"](http://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf).
201
+
The prettier-printer algorithm has been successfully employed by the [prettier](https://github.com/jlongster/prettier) JavaScript formatter.
202
+
203
+
Supervised by [@olafurpg](https://github.com/olafurpg)
204
+
187
205
*... Mentors: please insert your projects here. You can use the following template and submit a PR [here](https://github.com/scala/scala-lang). Note that student applications will end on April 3, 2017 ...*
0 commit comments