Skip to content

[lldb] Change some Swift REPL intro text #3125

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

Conversation

bitjammer
Copy link

@bitjammer bitjammer commented Jul 22, 2021

Note: This PR is for a pitch discussion and building a test toolchain. Do not merge – thanks!

Print a "starting up" message as it might take a long time for
everything to load, especially with cold module caches.

Clarify that :help is for help with debugger commands, not the
Swift language.

Tell people how to exit in case they don't know the EOF escape.

Remove the version print as that will be now be handled with
the swift command.

See https://forums.swift.org/t/command-line-ux-enhancements-for-swift/50670 for more context.

@bitjammer bitjammer force-pushed the acgarland/swift-repl-help-text branch from 8e5ec4e to b12b558 Compare August 3, 2021 18:18
@bitjammer bitjammer changed the title [Do not merge] [lldb] Change some Swift REPL intro text [lldb] Change some Swift REPL intro text Aug 18, 2021
@bitjammer
Copy link
Author

@bitjammer
Copy link
Author

@swift-ci Please test

printf("Welcome to %s.\nType :help for assistance.\n",
swift_full_version.c_str());
printf("You are now in an interactive environment powered by the LLDB debugger where you can type, run, and debug Swift code.\n\n");
printf("Type \x1B[1m:help\x1B[0m for debugger assistance. Type \x1B[1m:exit\x1B[0m to quit.\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this message. Maybe while we're at it, could we tell users that they can run any LLDB commands with :command? I feel that many users don't know that's possible,

I think we should definitely keep the swift version though, as that may be helpful to users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the reason why I removed the version print is that I pushed it up to the driver so that it appears consistently at the top when running other sort of "automatic" commands. If the Swift REPL is no longer run by default (something I eventually want to change), then running the REPL will be an explicit command without the larger context. It wouldn't hurt to print the version twice in the meantime but that was the reason, anyway.

std::string swift_full_version(swift::version::getSwiftFullVersion());
printf("Welcome to %s.\nType :help for assistance.\n",
swift_full_version.c_str());
printf("You are now in an interactive environment powered by the LLDB debugger where you can type, run, and debug Swift code.\n\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this message, seems a bit superfluous in my opinion.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went over this a little bit in the forum post. The reason for this message is that a lot of folks "end up" in the REPL, either intentionally or unintentionally through some default behavior. For folks learning Swift for the first time or someone who doesn't have a lot of command line experience with Swift, it can be rather mysterious as to what they are looking at. I thought it was also nice to call out that this is actually LLDB and not some other thing, so people start to understand the context they are in.

Again, if the REPL becomes an explicit choice, then of course the user should know where they are.

@@ -100,6 +100,7 @@ lldb::REPLSP SwiftREPL::CreateInstanceFromTarget(Status &err, Target &target,
lldb::REPLSP SwiftREPL::CreateInstanceFromDebugger(Status &err,
Debugger &debugger,
const char *repl_options) {
printf("Starting the Swift REPL...\n");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems ok since there's a bit of a delay before the REPL is available.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, a cold module cache can create some pretty long wait times on slower machines.

Print a "starting up" message as it might take a long time for
everything to load, especially with cold module caches.

Clarify that :help is for help with debugger commands, not the
Swift language.

Tell people how to exit in case they don't know the EOF escape.

Remove the version print as that will be now be handled with
the `swift` command.
@bitjammer bitjammer force-pushed the acgarland/swift-repl-help-text branch from b12b558 to fdc6cc4 Compare September 9, 2021 21:36
@bitjammer
Copy link
Author

@swift-ci Please test

@shahmishal shahmishal deleted the branch swiftlang:swift/main October 19, 2021 17:56
@shahmishal shahmishal closed this Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants