-
Notifications
You must be signed in to change notification settings - Fork 895
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
Generate completion files on toolchain switch or update #4152
Comments
Seems like a reasonable improvement. @rami3l any thoughts? |
@djc I am surprised to find out about this suggestion just now. The proper way of doing this definitely won't be re-generating completions on toolchain switch though (I won't do this on my machine anyway). I remember saying somewhere that we need a static skeleton for completions and then update them on re-installations of Rustup itself. Hopefully this will just be a documentation thing. For the dynamic part of this, we will need to add specific support. |
Interestingly enough,
|
@djc As you may already know, I use Homebrew's Rustup distribution, and so far the completion file is purely static. This is a recurring pattern for many applications, for which Homebrew has very good support: generate_completions_from_executable(bin/"rustup", "completions") |
There are 2 cases:
When |
@rosingrind Thanks for your reply. However I still doubt if anything should be regenerated even for
Update: I just found out that our completion script is already dynamic for > rustup completions zsh cargo
#compdef cargo
if command -v rustc >/dev/null 2>&1; then
source "$(rustc --print sysroot)"/share/zsh/site-functions/_cargo
fi ... where |
My conclusion is that https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell needs to be changed to align with Also, we need to check whether we should update the completion files on a per-update basis. However I think we should just dump our files somewhere (like |
Problem you are trying to solve
To utilize
rustup
completions, you are suggested to runrustup completions
every time login shell is opened https://rust-lang.github.io/rustup/installation/index.html#enable-tab-completion-for-bash-fish-zsh-or-powershell. On some machines, this may drastically affect shell startup timeSolution you'd like
rustup completions
can be called in arustup
internal post-install routine and generate proper completion files after updating or switching toolchain (or at first install); users will be able to source pre-baked completion files without callingrustup
each time they login to shellNotes
An example of how this process may look for
zsh
:rustup update
altersrustup
andcargo
versions, new cli arguments are addedrustup completions zsh rustup >$RUSTUP_HOME/completions/_rustup
makes completions forrustup
rustup completions zsh cargo >$CARGO_HOME/completions/_cargo
makes completions forcargo
rm -f ~/.zcompdump; compinit
to reset and reload completions inzsh
FPATH="$RUSTUP_HOME/completions:$CARGO_HOME/completions:$FPATH"
in their.zshrc
, the completions will work and be up-to-dateThe text was updated successfully, but these errors were encountered: