解决方法
您的主目录中有一个名为.scala_history的文件,其中包含您最近的所有REPL历史记录.我经常将此文件中的代码复制并粘贴到项目源文件中.它与显示REPL中各个方法的代码并不完全相同,但它可能有助于您实现相同的目标.
有关REPL中某些相关功能的讨论(历史中的分组语句),请参阅Paul Phillips在this issue中的评论:
At some point I implemented the logic for this,but the real obstacle
is jline. It has enough trouble figuring out where the cursor is under
the simplest conditions. Start throwing big multiline blocks into the
history and it breaks down in tears. Would love to see this and
SI-2547 addressed by the community.…
I expect to fix this soon too,but it depends on how well the recent
jline work goes. I implemented it long ago,and display issues are the
impediment.
这两个评论都超过两年了,所以我不会屏住呼吸.