Skip to content

bug: Completion of set command uses all available versions not just the installed ones #2134

Open
@jonatan-ivanov

Description

@jonatan-ivanov

Describe the Bug

The (zsh) completion of the set subcommand uses the asdf list all "$plugin" command to list the available versions to set. The problem is that asdf list all "$plugin" lists all the available versions (to install), not only the installed ones. This makes the completion of set useless since that subcommand should only need to browse the installed versions.

For example, let's say you use the java plugin, and you have three Java versions installed. When you use asdf set java, you will get 1948 options as of today not three:

asdf list all java | wc -l
    1948

See

if versions=$(asdf list all "${words[3]}" 2>/dev/null); then

and
if versions=$(asdf list all "$plugin" 2>/dev/null); then

Steps to Reproduce

asdf set <plugin-name><tab><tab>

Expected Behaviour

Listing the installed versions, the output of asdf list "$plugin" instead of asdf list all "$plugin".

Actual Behaviour

Listing every version available, not only the versions that are installed.

Environment

❯ asdf info
OS:
Darwin <hostname> 24.5.0 Darwin Kernel Version 24.5.0: Tue Apr 22 19:54:43 PDT 2025; root:xnu-11417.121.6~2/RELEASE_ARM64_T8132 arm64

SHELL:
zsh 5.9 (arm64-apple-darwin24.0)

BASH VERSION:
5.2.37(1)-release

ASDF VERSION:
0.18.0 (revision unknown)

ASDF INTERNAL VARIABLES:
ASDF_TOOL_VERSIONS_FILENAME=.tool-versions
ASDF_DATA_DIR=/Users/<user>/.asdf
ASDF_CONFIG_FILE=/Users/<user>/.asdfrc

ASDF INSTALLED PLUGINS:
java      https://github.com/halcyon/asdf-java.git
          e18c5fcf11d990392abd59a71faa299e8b2e9a21
nodejs    https://github.com/asdf-vm/asdf-nodejs.git
          fd2c7f94c4c71416047cacf2af6e4fa819b364b7

asdf plugins affected (if relevant)

all

See: #2022

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions