diff --git a/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala b/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala index eb97d3ead0c..87a1fe8b5e1 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/Embedded.scala @@ -5,6 +5,7 @@ import java.nio.file.Path import java.util.ServiceLoader import scala.collection.concurrent.TrieMap +import scala.util.Properties import scala.meta.internal.metals.MetalsEnrichments._ import scala.meta.internal.pc.ScalaPresentationCompiler @@ -170,6 +171,7 @@ final class Embedded( } object Embedded { + private val jdkVersion = JdkVersion.parse(Properties.javaVersion) lazy val repositories: List[Repository] = Repository.defaults().asScala.toList ++ @@ -270,6 +272,13 @@ object Embedded { if (scalaBinaryVersion == "2.11") "2.2.24" // from 2.2.24 mdoc is compiled with 3.1.x which is incompatible with 3.0.x else if (scalaVersion.exists(_.startsWith("3.0"))) "2.2.23" + // from 2.4.0 mdoc is released with Scala LTS 3.3.x + else if ( + scalaVersion.exists(_.startsWith("3.1")) || + scalaVersion.exists(_.startsWith("3.2")) + ) "2.3.8" + // from 2.5.0 mdoc is released with JDK 11 + else if (jdkVersion.exists(_.major < 11)) "2.4.0" else BuildInfo.mdocVersion, ) } diff --git a/project/V.scala b/project/V.scala index cce13763735..440e476ee57 100644 --- a/project/V.scala +++ b/project/V.scala @@ -33,7 +33,7 @@ object V { val lsp4jV = "0.20.1" val mavenBloop = "2.0.0" val mill = "0.11.5" - val mdoc = "2.4.0" + val mdoc = "2.5.1" val munit = "1.0.0-M10" val pprint = "0.7.3" val sbtBloop = bloop diff --git a/project/plugins.sbt b/project/plugins.sbt index e18bbfa7a57..e1bc111b608 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,7 +1,7 @@ addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.11.1") addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.5.12") -addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.4.0") +addSbtPlugin("org.scalameta" % "sbt-mdoc" % "2.5.1") addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.11.0") addSbtPlugin("com.github.reibitto" % "sbt-welcome" % "0.3.2")