Skip to content
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

Update scalameta to 4.4.4 #442

Merged
merged 1 commit into from
Dec 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ lazy val sharedSettings = List(
)

val V = new {
val scalameta = "4.4.0"
val scalameta = "4.4.4"
val munit = "0.7.20"
val coursier = "1.0.2"
val scalacheck = "1.15.2"
Expand Down
5 changes: 1 addition & 4 deletions mdoc/src/main/scala-2/mdoc/internal/markdown/Processor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ object MdocDialect {
def parse(path: AbsolutePath): Parsed[Source] = {
scala(Input.VirtualFile(path.toString(), path.readText)).parse[Source]
}
val scala = Scala213.copy(
allowToplevelTerms = true,
toplevelSeparator = ""
)
val scala = Scala213.withAllowToplevelTerms(true)
}

class Processor(implicit ctx: Context) {
Expand Down
39 changes: 13 additions & 26 deletions mdoc/src/main/scala/mdoc/internal/pos/PositionSyntax.scala
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,22 @@ object PositionSyntax {
.append("\n")
.append(pos.lineContent)
.append("\n")
.append(pos.lineCaret)
.append(lineCaret(pos))
.toString
}

private def lineCaret(pos: Position): String =
pos match {
case Position.None =>
""
case _ =>
val caret =
if (pos.start == pos.end) "^"
else if (pos.startLine == pos.endLine) "^" * (pos.end - pos.start)
else "^"
(" " * pos.startColumn) + caret
}

implicit class XtensionPositionsScalafix(private val pos: Position) extends AnyVal {

def contains(other: Position): Boolean = {
Expand All @@ -156,31 +168,6 @@ object PositionSyntax {
def rangeNumber: String =
s"${pos.startLine + 1}:${pos.startColumn + 1}..${pos.endLine + 1}:${pos.endColumn + 1}"

def lineCaret: String =
pos match {
case Position.None =>
""
case _ =>
val caret =
if (pos.start == pos.end) "^"
else if (pos.startLine == pos.endLine) "^" * (pos.end - pos.start)
else "^"
(" " * pos.startColumn) + caret
}

def lineContent: String =
pos match {
case Position.None => ""
case range: Position.Range =>
val pos = Position.Range(
range.input,
range.startLine,
0,
range.startLine,
Int.MaxValue
)
pos.text
}
}

implicit class XtensionThrowable(e: Throwable) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ object TokenEditDistance {

implicit val dialect: scala.meta.Dialect =
if (BuildInfo.scalaBinaryVersion.startsWith("2.")) scala.meta.dialects.Scala213
else scala.meta.dialects.Dotty
else scala.meta.dialects.Scala3

lazy val empty: TokenEditDistance = new TokenEditDistance(Array.empty)

Expand Down