Skip to content

Commit

Permalink
refactor: Refactor searching for config and remove handling of no lon…
Browse files Browse the repository at this point in the history
…ger relevant option
  • Loading branch information
tgodzik committed Oct 27, 2023
1 parent ae681ac commit 793152e
Showing 1 changed file with 4 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,6 @@ final class FormattingProvider(
tables.dismissedNotifications.CreateScalafmtFile
.dismiss(24, TimeUnit.HOURS)
None
} else if (item == Messages.dontShowAgain) {
tables.dismissedNotifications.CreateScalafmtFile
.dismissForever()
None
} else None
}
} else Future.successful(None)
Expand Down Expand Up @@ -424,14 +420,11 @@ final class FormattingProvider(
private def scalafmtConf(projectRoot: AbsolutePath): Option[AbsolutePath] = {
val configpath = userConfig().scalafmtConfigPath
val default: Option[AbsolutePath] = {
val defaultLocation = projectRoot.resolve(defaultScalafmtLocation)
lazy val scalacliDefault =
def defaultLocation = projectRoot.resolve(defaultScalafmtLocation)
def scalacliDefault =
projectRoot.resolve(".scala-build/.scalafmt.conf")
lazy val hiddenDefault = projectRoot.resolve(Directories.hiddenScalafmt)
if (defaultLocation.exists) Some(defaultLocation)
else if (scalacliDefault.exists) Some(scalacliDefault)
else if (hiddenDefault.exists) Some(hiddenDefault)
else None
def hiddenDefault = projectRoot.resolve(Directories.hiddenScalafmt)
List(defaultLocation, scalacliDefault, hiddenDefault).find(_.exists)
}
configpath.orElse(default)
}
Expand Down

0 comments on commit 793152e

Please sign in to comment.