@@ -41,7 +41,7 @@ object DottyIDEPlugin extends AutoPlugin {
4141 }
4242
4343 private def isDottyVersion (version : String ) =
44- version.startsWith(" 0." )
44+ version.startsWith(" 0." ) || version.startsWith( " 3. " )
4545
4646
4747 /** Return a new state derived from `state` such that scalaVersion returns `newScalaVersion` in all
@@ -234,10 +234,22 @@ object DottyIDEPlugin extends AutoPlugin {
234234 // IDE plugins to parse JSON.
235235 val dlsVersion = dottyVersion
236236 .replace(" -nonbootstrapped" , " " ) // The language server is only published bootstrapped
237- val dlsBinaryVersion = dlsVersion.split(" \\ ." ).take(2 ).mkString(" ." )
237+ val dlsBinaryVersion = dlsVersion.split(" [\\ .-]" ).toList match {
238+ case " 0" :: minor :: _ => s " 0. $minor"
239+ case " 3" :: minor :: patch :: suffix =>
240+ s " 3. $minor. $patch" + (suffix match {
241+ case milestone :: _ => s " - $milestone"
242+ case Nil => " "
243+ })
244+ case _ => throw new RuntimeException (
245+ s " Version $dlsVersion is not a Scala 3 version. " )
246+ }
238247 val pwArtifact = new PrintWriter (artifactFile)
239248 try {
240- pwArtifact.println(s " ch.epfl.lamp:dotty-language-server_ ${dlsBinaryVersion}: ${dlsVersion}" )
249+ if (dottyVersion.startsWith(" 0." ))
250+ pwArtifact.println(s " ch.epfl.lamp:dotty-language-server_ ${dlsBinaryVersion}: ${dlsVersion}" )
251+ else
252+ pwArtifact.println(s " org.scala-lang:scala3-language-server_ ${dlsBinaryVersion}: ${dlsVersion}" )
241253 } finally {
242254 pwArtifact.close()
243255 }
@@ -285,7 +297,15 @@ object DottyIDEPlugin extends AutoPlugin {
285297 // doesn't work for empty projects.
286298 val isScalaProject = (
287299 // Our `dotty-library` project is a Scala project
288- (projectName.startsWith(" dotty-library" ) || depClasspath.exists(_.getAbsolutePath.contains(" dotty-library" )))
300+ (
301+ projectName.startsWith(" dotty-library" ) ||
302+ projectName.startsWith(" scala3-library" ) ||
303+ depClasspath.exists { d =>
304+ val absolutePath = d.getAbsolutePath
305+ absolutePath.contains(" dotty-library" ) ||
306+ absolutePath.contains(" scala3-library" )
307+ }
308+ )
289309 && depClasspath.exists(_.getAbsolutePath.contains(" scala-library" ))
290310 )
291311
0 commit comments