Report warnings if not sources are found and sent to the user
Version(s) Scala CLI 1.5.4, but it doesn't happen reliably.
Describe the bug dependencySources request is met with an empty response
To Reproduce Try to start metals on a simple scripts as described in https://github.com/scalameta/metals/issues/6900
Expected behaviour We should report a warning in that case or ideally also retry fetching sources. (if that is a Bloop/Scala CLI race we might need to add more info to that warning)
@Gedochao, I'll take a look at this.
Here's what seems to be happening.
Running scala setup-ide . results in .bsp/scala.json args:
scala-cli --cli-default-scala-version 3.x.x --repository file://.../maven2 --prog-name scala bsp ....
I think the issue is that file://.../maven2 contains jars for Scala 3.x.x but it doesn't contain source jars.
You can see in the bloop configuration files, that sources for scala3-library_3 and scala-library are missing but present for other dependencies.
"resolution": {
"modules": [
{
"organization": "org.scala-lang",
"name": "scala3-library_3",
"version": "3.5.2",
"artifacts": [
{
"name": "scala3-library_3",
"path": "/Users/kmarek/Library/Caches/Coursier/arc/https/github.com/scala/scala3/releases/download/3.5.2/scala3-3.5.2-aarch64-apple-darwin.tar.gz/scala3-3.5.2-aarch64-apple-darwin/maven2/org/scala-lang/scala3-library_3/3.5.2/scala3-library_3-3.5.2.jar"
}
]
},
{
"organization": "org.scala-lang",
"name": "scala-library",
"version": "2.13.14",
"artifacts": [
{
"name": "scala-library",
"path": "/Users/kmarek/Library/Caches/Coursier/arc/https/github.com/scala/scala3/releases/download/3.5.2/scala3-3.5.2-aarch64-apple-darwin.tar.gz/scala3-3.5.2-aarch64-apple-darwin/maven2/org/scala-lang/scala-library/2.13.14/scala-library-2.13.14.jar"
}
]
},
{
"organization": "com.lihaoyi",
"name": "os-lib_3",
"version": "0.11.3",
"artifacts": [
{
"name": "os-lib_3",
"path": "/Users/kmarek/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/os-lib_3/0.11.3/os-lib_3-0.11.3.jar"
},
{
"name": "os-lib_3",
"classifier": "sources",
"path": "/Users/kmarek/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/os-lib_3/0.11.3/os-lib_3-0.11.3-sources.jar"
}
]
},
{
"organization": "com.lihaoyi",
"name": "geny_3",
"version": "1.1.1",
"artifacts": [
{
"name": "geny_3",
"path": "/Users/kmarek/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_3/1.1.1/geny_3-1.1.1.jar"
},
{
"name": "geny_3",
"classifier": "sources",
"path": "/Users/kmarek/Library/Caches/Coursier/v1/https/repo1.maven.org/maven2/com/lihaoyi/geny_3/1.1.1/geny_3-1.1.1-sources.jar"
}
]
}
]
}
@kasiaMarek that sounds like a bug in the scala wrapper then... Suspecting the source JARs aren't copied to the local repository during installation.
@hamzaremmal sounds like something we need to fix in the compiler repo.
Meanwhile, I suppose we should still warn the IDE when dependencySources come back empty.
Meanwhile, I suppose we should still warn the IDE when dependencySources come back empty.
If you add any dependency they won't be empty even when sources for scala lib are missing, so I'm not sure how useful such a warning would actually be.