Skip to content

Print a warning when a using directive is passed inside of the REPL #21654

@Gedochao

Description

@Gedochao

Is your feature request related to a problem? Please describe.
Users get confused when Scala CLI style //> using directives are treated as regular comments in the REPL (and thus ignored).
Supporting them is a whole other can of worms, but since Scala CLI is now the official runner, it would make sense to warn users with an explanation how to use a directive when they try to paste one in the REPL.

Describe the solution you'd like
We need a warning with explanation what the user should do.
So something like:

Welcome to Scala 3.5.1 (17, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.
                                                                                                                 
scala> //> using dep com.lihaoyi::os-lib:0.10.7
[warn] using directives are not supported from inside of a REPL session. To benefit from a directive's effects, re-run the REPL using the 'scala' command and pass the directive inside of an input.                                                                            

scala> 

Describe alternatives you've considered
We could, of course, support a subset of Scala CLI directives inside of the REPL, but it's a complex discussion which is definitely outside of the scope of this issue.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions