I'd like to try to accommodate following use case with scala-cli: keep some scripts alongside my main project and still be able to browse/navigate them in IntelliJ.
I wasn't able to achieve it with ammonite, so I have huge hopes for scala-cli.
I tried to accomplish it by importing a script dir as bsp module into my project. Detailed steps below:
- Create simple script under
scripts dir
mkdir -p scripts
cat <<'EOT' > scripts/script.sc
import $ivy.`com.lihaoyi::upickle:1.4.0`
import ujson._
EOT
- run it with
scala-cli scripts/script.sc
- prepare ide support with
scala-cli setup-ide scripts
- Import the directory in Intellij with
File -> New -> Module from existing sources -> select scripts dir -> select BSP import
Unfortunately, this doesn't add the upickle to the classpath and so ujson is not recognized.
I'm not familiar with BSP that much but the generated .bsp/scala-cli.json file doesn't seem to mention external dependencies in any way.