Make TAB-completion behave as SHIFT-TAB in REPL except for ?(x,y) syntax #43577
+41
−12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
#38791 introduced the
?(x,y)TAB
syntax in REPL for discovering methods accepting given argument types. To avoid showing irrelevant suggestions, it was decided that only methods having at least one of their argument annotated by a non-Any
type would be shown when using a simple TAB, and all methods would only be shown when using SHIFT-TAB. For reference, check the NEWS entry or the documentation.However, this behavior of TAB vs SHIFT-TAB affects not only the
?(x,y)TAB
syntax, but also the usual REPL method completion. Consider:I'm not sure this behavior is desired, nor actually intentional. In particular, the docs were not updated: the entry on
max([1, 2], #TAB
completion currently does not show any of the proposed suggestions since they don't have a non-Any
argument type.This PR restores the previous behavior of simple TAB (identical to the current SHIFT-TAB) for everything but the
?(x,y)
syntax, where the distinction is kept. Alternatively, if the current behavior is preferred, at least the docs should be updated to make people think of using SHIFT-TAB instead of TAB. In any case, I think it's good to have this PR open to weigh the opinions of everyone.