Skip to content

Commit

Permalink
Router: always skip shebang line
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Oct 31, 2022
1 parent 69bad29 commit 2c82e5c
Showing 1 changed file with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import org.scalafmt.config.{ImportSelectors, Newlines, ScalafmtConfig, Spaces}
import org.scalafmt.internal.ExpiresOn.{After, Before}
import org.scalafmt.internal.Length.{Num, StateColumn}
import org.scalafmt.internal.Policy.NoPolicy
import org.scalafmt.sysops.FileOps
import org.scalafmt.util._
import org.scalameta.FileLine

Expand Down Expand Up @@ -89,8 +88,7 @@ class Router(formatOps: FormatOps) {
Seq(Split(NoSplit.orNL(next(ft).right.is[T.EOF]), 0))
case FormatToken(_: T.BOF, right, _) =>
val policy = right match {
case T.Ident(name) // shebang in .sc files
if FileOps.isAmmonite(filename) && name.startsWith("#!") =>
case T.Ident(name) if name.startsWith("#!") =>
val nl = findFirst(next(formatToken), Int.MaxValue) { x =>
x.hasBreak || x.right.is[T.EOF]
}
Expand Down

0 comments on commit 2c82e5c

Please sign in to comment.