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

Make TAB-completion behave as SHIFT-TAB in REPL except for ?(x,y) syntax #43577

Merged
merged 1 commit into from
Jan 4, 2022

Conversation

Liozou
Copy link
Member

@Liozou Liozou commented Dec 28, 2021

#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:

julia> foo(a; kwarg) = kwarg - a;

julia> foo( #TAB -> nothing

julia> foo( #SHIFT-TAB
foo(a; kwarg) in Main at REPL[1]:1

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.

@Liozou
Copy link
Member Author

Liozou commented Dec 28, 2021

An implementation note: there were different options but the simplest seemed to add an optional argument to completions. This might need updating FuzzyCompletions.jl and julia-vscode's completion file and others, I'm not really sure.

@Liozou Liozou added the REPL Julia's REPL (Read Eval Print Loop) label Dec 28, 2021
@Liozou
Copy link
Member Author

Liozou commented Jan 3, 2022

Sorry to bother you directly @timholy but since you authored #38791, would you mind checking whether the issue described above was intentional?
If so, I can close this PR, I'll open another one to indicate in the docs that SHIFT-TAB should be used for usual method completion as well in order to have all the results appear.

@timholy
Copy link
Member

timholy commented Jan 4, 2022

Not an intended consequence, thanks for fixing!

@timholy timholy merged commit 62e6d4d into JuliaLang:master Jan 4, 2022
@Liozou Liozou deleted the replcompletionmethodtab branch January 4, 2022 22:36
@Liozou
Copy link
Member Author

Liozou commented Jan 4, 2022

No problem, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
REPL Julia's REPL (Read Eval Print Loop)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants