Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Support 2-blank-line-termination in REPL in Scala 3 #17711

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

Closed
cruiztorresj opened this issue Jul 10, 2022 · 5 comments
Closed

Support 2-blank-line-termination in REPL in Scala 3 #17711

cruiztorresj opened this issue Jul 10, 2022 · 5 comments

Comments

@cruiztorresj
Copy link

Hello, I was trying to terminate a statement pressing enter twice but it only works for Scala 2, can you please make it available for Scala 3 over Java 17 too?

Here's a screenshot depicting the issue both with SBT and the Scala 3 standalone application.
console3

And here's a successful execution within Scala 2.
console2

Java Virtual Machine Information:
java 17.0.3.1 2022-04-22 LTS
Java(TM) SE Runtime Environment (build 17.0.3.1+2-LTS-6)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.3.1+2-LTS-6, mixed mode, sharing)

Thanks!

--
Caleb.

@som-snytt
Copy link
Contributor

I think this was deemed unnecessary because of magic JLine editing capabilities, but I can't find the ticket or conversation. I also thought ctl-c was supported, but for me it exits the REPL.

@cruiztorresj
Copy link
Author

Thanks for getting back with an answer.
I am not sure why it was deemed that way, IMO it is a Scala's REPL core functionality. It's even promoted in some books, e.g. THE Scala book by Martin Odersky et all.
Have a good day!

--
Caleb

@bishabosha
Copy link
Member

bishabosha commented Jul 11, 2022

If I could guess why this occurs it would be to support optional braces syntax - however to see 7 blank lines before any code is a bit absurd :)

Edit: I mean absurd for REPL to accept 7 blank lines as intentional code

@bishabosha bishabosha changed the title Please enable statement entry termination for Scala 3+ over Java 17 Support 2-blank-line-termination in REPL Jul 11, 2022
@cruiztorresj cruiztorresj changed the title Support 2-blank-line-termination in REPL Support 2-blank-line-termination in REPL in Scala 3 Jul 11, 2022
@cruiztorresj
Copy link
Author

Not absurd at all, those seven blank lines were meant to showcase enter was hit n (Seven in this case) number of times without the REPL terminating the statement as intended.
Thanks for changing this issue title, yours is more adequate.

Well, good luck buds. 🚀

@SethTisue
Copy link
Member

SethTisue commented Jul 11, 2022

Scala 2 lost this behavior around the time the JLine 3 upgrade landed (scala/bug#12266), but Dale and I restored it in scala/scala#9407

as discussed at 12266, control-G also works for noping out (including in Scala 3), so that's a workaround for now though as I wrote there:

tends to leave junk on the screen, but perhaps that's JLine's fault rather than something in the Scala integration

@ckipp01 ckipp01 transferred this issue from lampepfl/dotty-feature-requests May 31, 2023
@scala scala locked and limited conversation to collaborators May 31, 2023
@ckipp01 ckipp01 converted this issue into discussion #17712 May 31, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants