-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
REPL: add wildcard to autocompletion #27337
Comments
I don't like that this would override the completion of a multiplication expression. -1 for the moment. |
@devsnek I suggest to only filter the former in case there's no whitespace in-between the variables. With whitespace, the multiplication expression would still have the completion as before. |
I mean without whitespace it's still multiplication, and people aren't generally aiming for perfect formatting when typing in a repl. (and some people consider no spaces perfect formatting so...) |
How does this work as auto-completion? It’s one thing to print all possibilities, but how would you pick the right one? This seems like an unusual feature for an auto-completion system – I don’t think I know of any precedent. So, if we were to implement this, I think we have the option to not use an asterisk, which would be good for the reason @devsnek mentions. |
one thing you could consider is doing a fuzzy match on the last item instead of a start of string match, so |
It's actually a filter in this case. I some times use this to match files. E.g., if you have a file named In this case I would like it to work as filter. It matches against all parts before the asterix and then filters the entries with the part after the asterix. It is actually also possible to distinguish multiplications in case no whitespace is used by checking if the part before the asterix is a variable. If it is, the filter should not be triggered and it should work as it does right now (we could even check for type number). |
-1 this seems too magical and unexpected |
@mscdex since it's an opt-in, is there a downside? There are similar implementations in at least some unix terminals, so I guess it's mainly beneficial for people who know it from there as well. |
What do you mean opt-in? A command-line flag? I doubt many people would opt-in to this kind behavior. It might be popular behavior for *nix shells because the role of a shell is a bit wider in scope than just any old programming language REPL. I've also never seen/heard of this behavior being implemented in any other language's REPL. |
I am going to close this as there are quite a few more important things for the REPL on my TODO list. If I get to it, I'll just open a PR and see what people think about it. |
In most terminals it's possible to use an asterix (
*
) to indicate a wildcard search (as filter).It would be great to add something like this to our REPL as well, e.g., using the current autocompletion with
util.types.is*F
results in the globals that start with anF
. Instead, it would be great to print allis
functions that start withis
and that have anF
somewhere in their name.Using the asterix at the end should print everything as if it's not there (it currently prints nothing).
The text was updated successfully, but these errors were encountered: