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

Lazy completion loading for Zsh #475

Merged
merged 2 commits into from
Mar 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions argcomplete/shell_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from shlex import quote

bashcode = r"""
bashcode = r"""#compdef %(executables)s
# Run something, muting output or redirecting it to the debug stream
# depending on the value of _ARC_DEBUG.
# If ARGCOMPLETE_USE_TEMPFILES is set, use tempfiles for IPC.
Expand Down Expand Up @@ -75,8 +75,16 @@
if [[ -z "${ZSH_VERSION-}" ]]; then
complete %(complete_opts)s -F _python_argcomplete%(function_suffix)s %(executables)s
else
# When called by the Zsh completion system, this will end with
# "loadautofunc" when initially autoloaded and "shfunc" later on, otherwise,
# the script was "eval"-ed so use "compdef" to register it with the
# completion system
autoload is-at-least
compdef _python_argcomplete%(function_suffix)s %(executables)s
if [[ $zsh_eval_context == *func ]]; then
_python_argcomplete%(function_suffix)s "$@"
else
compdef _python_argcomplete%(function_suffix)s %(executables)s
fi
fi
"""

Expand Down