Skip to content

Generate completion files on toolchain switch or update #4152

Open
@rosingrind

Description

@rosingrind

Problem you are trying to solve

To utilize rustup completions, you are suggested to run rustup 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 time

Solution you'd like

rustup completions can be called in a rustup 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 calling rustup each time they login to shell

Notes

An example of how this process may look for zsh:

  • calling rustup update alters rustup and cargo versions, new cli arguments are added
  • after successful update, a post-install routine of completion generation started:
    • rustup completions zsh rustup >$RUSTUP_HOME/completions/_rustup makes completions for rustup
    • rustup completions zsh cargo >$CARGO_HOME/completions/_cargo makes completions for cargo
    • performing rm -f ~/.zcompdump; compinit to reset and reload completions in zsh
  • if user has FPATH="$RUSTUP_HOME/completions:$CARGO_HOME/completions:$FPATH" in their .zshrc, the completions will work and be up-to-date

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions