scala-cli icon indicating copy to clipboard operation
scala-cli copied to clipboard

Sources not visible from IntelliJ (via BSP) with `using sourceJar` and non-standard -sources.jar file paths

Open olafurpg opened this issue 1 year ago • 0 comments

Version(s)

❯ scala-cli --version
Scala CLI version: 1.3.2
Scala version (default): 3.4.2

Describe the bug

When importing a project into IntelliJ via BSP, I'm unable to see the source code of dependencies even with the // using sourceJar "PATH_TO_JAR" syntax.

To Reproduce

  • Create a jar file with source code and name the file something random.
  • Add // using sourceJar "PATH_TO_JAR"
  • Import the project into IntelliJ via BSP
  • I'm not able to view the sources

Expected behaviour I can view the sources in IntelliJ, or scala-cli should at least error when it encounters a // using sourceJar directory without a companion //> using jar.

Workaround I was able to work around the issue by creating symbolic links that have file paths ORIGINAL_NON_SOURCE_JAR-sources.jar. For example, when my build.scala looks like this https://gist.github.com/olafurpg/4db688793658d1b6ce7c6d5305534e73 then it works as expected.

olafurpg avatar Jun 11 '24 13:06 olafurpg