Skip to content

Import scala-cli scripts directory as bsp module into Intellij sbt project #260

@Krever

Description

@Krever

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:

  1. 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
  1. run it with scala-cli scripts/script.sc
  2. prepare ide support with scala-cli setup-ide scripts
  3. 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions