New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#356 Code with windows line endings after formatting still has windows endings #445
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing, thank you for this contribution. Only a few minor comments, otherwise we're good to merge 👍
} | ||
} | ||
} catch { | ||
// TODO(olafur) add more fine grained errors. | ||
case NonFatal(e) => FormatResult.Failure(e) | ||
} | ||
} | ||
|
||
private[this] def containsWindowsLineEndings(code: String): Boolean = | ||
code.contains("\r\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WindowsLineEnding
?
import org.scalatest.FunSuite | ||
|
||
class LineEndingsTest extends FunSuite with DiffAssertions { | ||
val javadocStyle = ScalafmtStyle.default.copy(scalaDocs = false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not default style?
Corrected, squashed, pushed :) |
One last thought, should we have a flag to disable this new behavior? |
Whoops, I was fiddling with automatic publishing from travis (only possible from master branch) and just remembered that I disabled the tests suite to get faster experiments. Could you rebase on master and re-sync? |
Yes please, so that |
Current coverage is 87.23% (diff: 92.00%)@@ master #445 diff @@
==========================================
Files 35 35
Lines 2228 2249 +21
Methods 2092 2116 +24
Messages 0 0
Branches 136 133 -3
==========================================
+ Hits 1942 1962 +20
- Misses 286 287 +1
Partials 0 0
|
@sjrd how about a flag like This option could be a sealed abstract class |
@olafurpg as |
@mmatloka Hmmm. Excellent question. I think preserve should be the behavior implemented in this PR. The current master branch behavior is buggy. |
@mmatloka For the readme, it should be |
@@ -293,3 +293,14 @@ | |||
function( | |||
argument1, | |||
argument2) | |||
@sect{--lineEndings} | |||
Default: @b(preserve) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@b{preserve}
will do the trick ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks :)
I have added the flag. Included in tests and docs, however I was not able to generate readme from scalatex locally, I don't know why yet ( |
LGTM. Thanks a lot for this contribution 😄 I expect to release very soon, the wifi is pretty bad at home so I may wait until tomorrow when I go to work. |
Thanks :) |
I am afraid the 0.3.2 release is taking longer than I expected. Is that OK? I have some exciting features in the pipeline that are almost complete and I want to bundle everything in a 0.4. |
Related to: https://github.com/olafurpg/scalafmt/issues/365#issuecomment-243346157