-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Remove pipes from multi-line REPL prompts #24307
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
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -33,12 +33,12 @@ class JLineTerminal extends java.io.Closeable { | |||||
| builder.build() | ||||||
| private val history = new DefaultHistory | ||||||
|
|
||||||
| private def blue(str: String)(using Context) = | ||||||
| if (ctx.settings.color.value != "never") Console.BLUE + str + Console.RESET | ||||||
| private def purple(str: String)(using Context) = | ||||||
| if (ctx.settings.color.value != "never") Console.MAGENTA + str + Console.RESET | ||||||
| else str | ||||||
| protected def promptStr = "scala" | ||||||
| private def prompt(using Context) = blue(s"\n$promptStr> ") | ||||||
| private def newLinePrompt(using Context) = blue(" | ") | ||||||
| protected def promptStr = "@" | ||||||
| private def prompt(using Context) = purple(s"\n$promptStr ") | ||||||
| private def newLinePrompt(using Context) = purple(" ") | ||||||
|
||||||
| private def newLinePrompt(using Context) = purple(" ") | |
| private def newLinePrompt(using Context) = purple(">") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem with adding >s in subsequent lines is it makes copy paste harder. Without the > you just copy-paste-dedent, with the > you paste and the need to remove the > from each subsequent line, and also manually remove the space since it'll be one remaining space so a 2-space dedent doesnt work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@is a cute symbol for ammonite (the name), but that cuteness does not apply for Scala in general. There's no precedent (that I know of) for this symbol being used as a general prompt anywhere.I'm not against using a short prompt but then it should just be
>like virtually all prompts in existence.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A large motivation for the recent effort to renovate the REPL has been to merge all the useful parts of Ammonite into it: pretty-printed output, ctrl-c handling, library import, etc.. I expect Ammonite as a standalone project will go into maintenance mode soon after 3.8.0 is released.
Given that,
@looking like the Ammonite REPL is exactly what we want: for all intents and purposes, Ammonite going forward will be the default Scala REPL, and any association that people have with the@symbol is exactly right.We can come up with a new symbol, we can use
>which is shared by a bunch of other REPLs. But@is already widely known in the Scala community, has exactly the right associations (Scala REPL ++) and soon-to-be unambigious. So there's plenty of upsides of using this symbol and no long-term downsidesThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...wait, slow down. While we very much appreciate all the improvements brought over from Ammonite REPL, Scala REPL remains its own thing. If anything, I think users may be confused with the
@being there. Some Ammonite REPL features won't be brought over (like the Ammonite style directives, for example).I'm a fan of going with
>myself, too.We'll discuss how to move forward on Scala Core.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe instead of having long discussions, trying to figure out what would be best for users, maybe we could let them decide themselves? Personally, I've recently become a bit crazy about how one can make their life easier by customizing their shell prompt, but I wouldn't go too far for this moment. The prompt in the REPL could be configurable as a simple string (and maybe as a color) via a scala-cli flag (or potentially also via a directive to let people use a scala file as a template for REPL settings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...we probably could make whatever we decide on customisable, yeah. 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with
>if that's what you all prefer, just let me know the decision and I'll update the PRThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with the arguments against
@