bug: Completion of set command uses all available versions not just the installed ones
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 941
- Avg merge
- 9h 24m
- Merged PRs (30d)
- 3
Description
### 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:
```sh
asdf list all java | wc -l
1948
```
See
https://github.com/asdf-vm/asdf/blob/2114f1ebc15b3f1653228c8b416f759898a58dc7/internal/completions/asdf.zsh#L314
and
https://github.com/asdf-vm/asdf/blob/2114f1ebc15b3f1653228c8b416f759898a58dc7/internal/completions/asdf.zsh#L329
### Steps to Reproduce
`asdf set `
### 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
```shell
❯ asdf info
OS:
Darwin 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//.asdf
ASDF_CONFIG_FILE=/Users//.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: https://github.com/asdf-vm/asdf/pull/2022
Contributor guide
Research direction
Start in internal/completions/asdf.zsh at the completion logic around lines 314 and 329. Compare the version source used by the set subcommand with the installed-version command described in the issue, then reproduce asdf set and confirm that only installed versions are listed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- shell, zsh
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 50/100