[SI-9214] REPL transcript paste can't be saved Created: 11/Mar/15  Updated: 19/Mar/15

Status: Open
Project: Scala Programming Language
Component/s: Repl / Interpreter
Affects Version/s: Scala 2.11.6
Fix Version/s: None

Type: Improvement Priority: Major
Reporter: A. P. Marki Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

If a SO answer is in REPL transcript form, people want to be able to copy/paste it to their REPL and save the session.

That's not currently possible, although the transcript can be edited from history (but they could have pasted directly to their editor at that point).

A session is not exactly valid code, so it would be nice if save command had an option to fix things up a bit.

scala> scala> import PartialFunction._
 
// Detected repl transcript paste: ctrl-D to finish.
 
import PartialFunction._
 
scala> // more transcript and ctrl-D
// Replaying 3 commands from transcript.
 
scala> import PartialFunction._
import PartialFunction._
 
scala> // more
 
 
scala> :save useful.script
No replay commands in session
 
scala> "abc"
res2: String = abc
 
scala> .length
res3: Int = 3
 
scala> :save useful.script

The script from the last commands looks like:

"abc"
res2.length


Generated at Wed Oct 24 08:06:48 CEST 2018 using JIRA 7.9.1#79001-sha1:60970b42586a2ec2760ed6cfe825b26961e62b9e.