From adfdae937c4c3caed51e1e2d6675618022436a41 Mon Sep 17 00:00:00 2001 From: Albert Meltzer <7529386+kitbellew@users.noreply.github.com> Date: Sun, 31 Mar 2024 13:41:50 -0700 Subject: [PATCH] scalafmt: improve imports formatting --- .scalafmt.conf | 8 ++++++-- .../src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index 29a8dab..fea59ff 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -21,12 +21,16 @@ rewrite { SortModifiers ] imports { + expand = true sort = ascii groups = [ - ["javax?\\..*"], + ["java.?\\..*"], ["sbt\\..*"], + ["scala\\.meta\\..*"], ["scala\\..*"], - ["org\\..*"] + ["org\\.scalafmt\\..*", "org\\.scalameta\\..*"], + ["org\\..*"], + ["com\\..*"], ] } redundantBraces { diff --git a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala index 1c07199..3b64069 100644 --- a/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala +++ b/plugin/src/main/scala/org/scalafmt/sbt/ScalafmtPlugin.scala @@ -78,7 +78,9 @@ object ScalafmtPlugin extends AutoPlugin { case class ScalafmtAnalysis(failedScalafmtCheck: Set[File]) object ScalafmtAnalysis { - import sjsonnew.{:*:, LList, LNil} + import sjsonnew.:*: + import sjsonnew.LList + import sjsonnew.LNil implicit val analysisIso = LList.iso( { a: ScalafmtAnalysis => ("failedScalafmtCheck", a.failedScalafmtCheck) :*: LNil