Skip to content

Add support for the :paste command in the REPL #21660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
Gedochao opened this issue Sep 27, 2024 · 3 comments
Open

Add support for the :paste command in the REPL #21660

Gedochao opened this issue Sep 27, 2024 · 3 comments
Labels
area:repl compat:scala2:feature-parity Issues tied with features which were at some point included in Scala 2 and could be brought over. itype:enhancement

Comments

@Gedochao
Copy link
Contributor

The :paste command was (and is) supported by the Scala 2 REPL, while it is visibly absent in Scala 3.

scala -S 2.13
Welcome to Scala 2.13.15 (OpenJDK 64-Bit Server VM, Java 17).
Type in expressions for evaluation. Or try :help.
scala> :help
All commands can be abbreviated, e.g., :he instead of :help.
(...)
:paste [-raw] [path]     enter paste mode or paste a file
(...)
scala> :paste
// Entering paste mode (ctrl-D to finish)

println("I")
println("paste")
println("stuff")

// Exiting paste mode... now interpreting.
I
paste
stuff

scala> 
@Gedochao Gedochao added itype:enhancement area:repl compat:scala2:feature-parity Issues tied with features which were at some point included in Scala 2 and could be brought over. labels Sep 27, 2024
@SethTisue
Copy link
Member

:paste was originally added to Scala 2 at a time when JLine didn't yet have support for multiline editing

I doubt it's worth re-implementing in Scala 3. but, see discussion at https://users.scala-lang.org/t/solved-cannot-use-paste-in-scala3-repl/7587/19

@Gedochao
Copy link
Contributor Author

Gedochao commented Jan 23, 2025

Similarly to :sh, as per #21657 (comment), calling :paste should print a warning about it not being supported in the Scala 3 REPL, and about it not being needed, since JLine supports multiline editing.

@SethTisue should we deprecate :paste in Scala 2?

@SethTisue
Copy link
Member

@SethTisue yes; I've added a note to the Scala 2 ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:repl compat:scala2:feature-parity Issues tied with features which were at some point included in Scala 2 and could be brought over. itype:enhancement
Projects
None yet
Development

No branches or pull requests

2 participants