-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Support command prefixes in REPL #8901
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
e.g. `:q` or `:qu` instead of `:quit`. If exactly one command matching the prefix is found, it is executed. If multiple matching commands are found, an error is shown. (Currently this is not possible, as each command starts with a different letter.)
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.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Have an awesome day! ☀️
They're in https://github.com/lampepfl/dotty/tree/master/compiler/test/dotty/tools/repl |
There's also scripted repl tests in https://github.com/lampepfl/dotty/tree/master/compiler/test-resources |
This closes #115 in the feature requests repl. |
matchingParsers match { | ||
case Nil => UnknownCommand(cmd) | ||
case f :: Nil => f(arg) | ||
case _ => AmbiguousCommand(cmd) |
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.
Can you pass the list of matching commands here to make the error message more descriptive?
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.
Good idea. Fixed.
e.g.
:q
or:qu
instead of:quit
.If exactly one command matching the prefix is found, it is executed.
If multiple matching commands are found, an error is shown. (Currently this is not possible, as each command starts with a different letter.)
I've tested manually but couldn't find any automated tests for the REPL. Happy to write a test if someone can point me to the right place.Added a scripted test.