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

Make sbt-scalafmt incremental #1136

merged 6 commits into from Apr 15, 2018


2 participants

vovapolu commented Apr 15, 2018

This PR adds caching for formatting and for config files.


LGTM 👍 Thanks!

object FormattingCache {
private val lastFormatting = mutable.Map.empty[File, Long]
def outdatedFormatting(file: File): Boolean =

This comment has been minimized.


olafurpg Apr 15, 2018

object Caching {
  def format[T](file: File)(f: () => Unit): Unit = {
    if (isOutdated(file)) {
      cache(file) = file.lastModified
  private val cache = mutable.Map.empty[File, Long]
  private def isOutdated(file: File): Boolean=
    cache.get(file).forall(_ < file.lastModified)

@olafurpg olafurpg merged commit 379c2d0 into scalameta:master Apr 15, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed

@olafurpg olafurpg changed the title from sbt plugin formatting caching to Make sbt-scalafmt incremental Apr 23, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment