@@ -41,7 +41,7 @@ object DottyIDEPlugin extends AutoPlugin {
41
41
}
42
42
43
43
private def isDottyVersion (version : String ) =
44
- version.startsWith(" 0." )
44
+ version.startsWith(" 0." ) || version.startsWith( " 3. " )
45
45
46
46
47
47
/** Return a new state derived from `state` such that scalaVersion returns `newScalaVersion` in all
@@ -234,10 +234,22 @@ object DottyIDEPlugin extends AutoPlugin {
234
234
// IDE plugins to parse JSON.
235
235
val dlsVersion = dottyVersion
236
236
.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
+ }
238
247
val pwArtifact = new PrintWriter (artifactFile)
239
248
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}" )
241
253
} finally {
242
254
pwArtifact.close()
243
255
}
@@ -285,7 +297,15 @@ object DottyIDEPlugin extends AutoPlugin {
285
297
// doesn't work for empty projects.
286
298
val isScalaProject = (
287
299
// 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
+ )
289
309
&& depClasspath.exists(_.getAbsolutePath.contains(" scala-library" ))
290
310
)
291
311
0 commit comments