Skip to content
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

feat(repl): autocomplete repl commands #14627

Merged
merged 3 commits into from
Mar 9, 2022
Merged

Conversation

ckipp01
Copy link
Member

@ckipp01 ckipp01 commented Mar 6, 2022

This adds in completion for the available commands in the repl just like
there is for Scala 2. For example you can do :@@ which will give you
back all the commands.

2022-03-06 09 16 23

@ckipp01 ckipp01 marked this pull request as draft March 7, 2022 09:12
@ckipp01 ckipp01 marked this pull request as ready for review March 7, 2022 09:39
@ckipp01 ckipp01 requested a review from prolativ March 7, 2022 09:39
ckipp01 added 3 commits March 7, 2022 20:58
This adds in completion for the available commands in the repl just like
there is for Scala 2. For example you can do `:@@` which will give you
back all the commands.
In the situation where we have `:im<tab>` normally `:` and `im` would be split into
two tokens and it would result in `::imports`. Instead, we detect early if we are
about to complete a command and instead of parsing it normally like Scala we just
grab the entire thing as the word.
@ckipp01
Copy link
Member Author

ckipp01 commented Mar 8, 2022

Alright, I think I have the issues addressed now. In the case where you're about to complete a command we detect it early in JLineTerminal#Parser#parse and don't treat :im as two tokens but rather :im as one and so that it correctly gets replaced as :imports rather than ::imports. I also have a test for this.

@ckipp01 ckipp01 requested a review from prolativ March 8, 2022 17:50
@som-snytt
Copy link
Contributor

Nice. The Scala 2 fix was a year ago with I guess similar insight, I've totally forgotten. I'll migrate "understand jline" from last year's new year's resolutions.

@prolativ prolativ merged commit f7ede22 into scala:main Mar 9, 2022
@ckipp01 ckipp01 deleted the commands branch March 9, 2022 09:58
@Kordyjan Kordyjan added this to the 3.1.3 milestone Aug 2, 2023
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.

5 participants