mirror of https://github.com/sbt/sbt.git
Fix bimcompat breakages in complete
Fixes https://github.com/sbt/sbt/issues/4268
This commit is contained in:
parent
2d106d92a5
commit
4ecb3a3f7c
|
|
@ -192,7 +192,9 @@ val completeProj = (project in file("internal") / "util-complete")
|
||||||
name := "Completion",
|
name := "Completion",
|
||||||
libraryDependencies += jline,
|
libraryDependencies += jline,
|
||||||
mimaSettings,
|
mimaSettings,
|
||||||
mimaBinaryIssueFilters ++= Seq(
|
// Parser is used publicly, so we can't break bincompat.
|
||||||
|
mimaBinaryIssueFilters := Seq(
|
||||||
|
exclude[DirectMissingMethodProblem]("sbt.internal.util.complete.History.this"),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
.configure(addSbtIO, addSbtUtilControl)
|
.configure(addSbtIO, addSbtUtilControl)
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,12 @@ object EditDistance {
|
||||||
insertCost: Int = 1,
|
insertCost: Int = 1,
|
||||||
deleteCost: Int = 1,
|
deleteCost: Int = 1,
|
||||||
subCost: Int = 1,
|
subCost: Int = 1,
|
||||||
|
transposeCost: Int = 1,
|
||||||
matchCost: Int = 0,
|
matchCost: Int = 0,
|
||||||
caseCost: Int = 1,
|
caseCost: Int = 1,
|
||||||
transpositions: Boolean = false
|
transpositions: Boolean = false
|
||||||
): Int = {
|
): Int = {
|
||||||
|
val _ = transposeCost
|
||||||
val n = s.length
|
val n = s.length
|
||||||
val m = t.length
|
val m = t.length
|
||||||
if (n == 0) return m
|
if (n == 0) return m
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,8 @@ final class History private (val lines: IndexedSeq[String], val path: Option[Fil
|
||||||
}
|
}
|
||||||
|
|
||||||
object History {
|
object History {
|
||||||
|
def apply(lines: Seq[String], path: Option[File], error: String => Unit): History =
|
||||||
|
new History(lines.toIndexedSeq, path)
|
||||||
def apply(lines: Seq[String], path: Option[File]): History =
|
def apply(lines: Seq[String], path: Option[File]): History =
|
||||||
new History(lines.toIndexedSeq, path)
|
new History(lines.toIndexedSeq, path)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -387,7 +387,13 @@ trait ParserMain {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.*/
|
/** Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.*/
|
||||||
implicit def range(r: collection.immutable.NumericRange[Char], label: String): Parser[Char] =
|
implicit def range(r: collection.immutable.NumericRange[Char]): Parser[Char] = {
|
||||||
|
val label = r.map(_.toString).toString
|
||||||
|
range(r, label)
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Presents a Char range as a Parser. A single Char is parsed only if it is in the given range.*/
|
||||||
|
def range(r: collection.immutable.NumericRange[Char], label: String): Parser[Char] =
|
||||||
charClass(r contains _, label).examples(r.map(_.toString): _*)
|
charClass(r contains _, label).examples(r.map(_.toString): _*)
|
||||||
|
|
||||||
/** Defines a Parser that parses a single character only if it is contained in `legal`.*/
|
/** Defines a Parser that parses a single character only if it is contained in `legal`.*/
|
||||||
|
|
@ -400,7 +406,7 @@ trait ParserMain {
|
||||||
* Defines a Parser that parses a single character only if the predicate `f` returns true for that character.
|
* Defines a Parser that parses a single character only if the predicate `f` returns true for that character.
|
||||||
* If this parser fails, `label` is used as the failure message.
|
* If this parser fails, `label` is used as the failure message.
|
||||||
*/
|
*/
|
||||||
def charClass(f: Char => Boolean, label: String): Parser[Char] =
|
def charClass(f: Char => Boolean, label: String = "<unspecified>"): Parser[Char] =
|
||||||
new CharacterClass(f, label)
|
new CharacterClass(f, label)
|
||||||
|
|
||||||
/** Presents a single Char `ch` as a Parser that only parses that exact character. */
|
/** Presents a single Char `ch` as a Parser that only parses that exact character. */
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue