scalameta / metals-feature-requests

Issue tracker for Metals feature requests
37 stars 4 forks source link

Allow to use scalacli's using directives in worksheets #308

Open tgodzik opened 2 years ago

tgodzik commented 2 years ago

Is your feature request related to a problem? Please describe.

In ScalaCLI you can specify Scala version using:

//> using scala "2.13.10"

it would actually be pretty nice to add that maybe some other using directives to be available with worksheets and allow for more self contained worksheets.

Describe the solution you'd like

Worksheets allowing for at least some basic using directives:

//> using scala "2.13.10"
//> using lib "org.example:example:0.10.0"
//> using repository "jitpack"
//> using options "-Xasync", "-Xfatal-warnings"

Aside from specifying scala versions, it's already possible to change the other options within worksheets using magic imports.

Describe alternatives you've considered

For most of the other options you can use magic imports:

import $ivy.`org.example:example:0.10.0`
 import $repo.`https://jitpack.io`
import $scalac.`-Xasync`
import $scalac.`-Xfatal-warnings`

for Scala version, you can change fallback scala version to the one you want or just put it within sources that use a specific scala version.

Additional context

https://scala-cli.virtuslab.org/docs/reference/directives

Search terms

scalacli using worksheets