-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
SI-4684 Repl supports whole-file paste (rebased) #2725
Conversation
Add a file argument to the :paste command which loads the file's contents as though entered in :paste mode. The :paste command is replayable. Samples, including companions defined together: ``` scala> :paste junk.scala File contains no code: junk.scala scala> :paste no-file.scala That file does not exist scala> :paste obj-repl.scala Pasting file obj-repl.scala... <console>:2: error: expected start of definition private foo = 7 ^ scala> :paste hw-repl.scala Pasting file hw-repl.scala... The pasted code is incomplete! <pastie>:5: error: illegal start of simple expression } ^ scala> :replay Replaying: :paste junk.scala File contains no code: junk.scala Replaying: :paste obj-repl.scala Pasting file obj-repl.scala... defined trait Foo defined object Foo Replaying: Foo(new Foo{}) res0: Int = 7 ```
By special request, :paste -raw simply compiles the pasted code to the repl output dir. The -raw flag means no wrapping; the pasted code must be ordinary top level Scala code, not script.
LGTM |
SI-4684 Repl supports whole-file paste (rebased)
Why not just fix |
|
@plmday |
Jinx. |
@retronym I don't understand what you mean by
|
@som-snytt What other features does |
I would ask on the ML for an extended discussion, but to illustrate, my
|
Re-rebased #2719: Rebased #2696
The first test repl-paste4 was failing for an unknown reason, with no diff in the build output.
This version makes that test a SessionTest with no check file. The research question is whether that changes how line endings are handled.
The second test was already a SessionTest but used a private version, but now it can use the class in partest.