Skip to content

bug: Regression in Zsh Completion for asdf Java set Command (v0.16.6 & v0.16.7) #2047

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

Open
michelemadonna opened this issue Mar 31, 2025 · 3 comments

Comments

@michelemadonna
Copy link

Describe the Bug

I have identified a regression in asdf versions 0.16.6 and 0.16.7 that affects the Zsh completion functionality. Specifically, when using the set command to configure the current Java JDK version, the completion system incorrectly suggests all installable JDK versions instead of only listing the currently installed JDK versions.

This issue was not present in asdf version 0.16.5, where the command completion correctly displayed only the JDK versions installed on the system.

Steps to Reproduce

  1. Install asdf v0.16.6 or v0.16.7.
  2. Use Zsh as your shell.
  3. Run the following command and attempt auto-completion:
  4. asdf set java
  5. Observe that the completion suggests all available JDKs (installable), rather than only the installed ones.
Image
  1. Downgrade to asdf v0.16.5.
  2. Run the same command again.
  3. Observe that the correct behavior is restored, showing only installed JDK versions.
Image

Expected Behaviour

When using the set command in Zsh completion, only the JDK versions installed on the system should be suggested.

Image

Actual Behaviour

When using the set command in Zsh completion, in versions 0.16.6 and 0.16.7, the completion instead lists all installable JDK versions.

Image

Environment

Macos 15.3.2
zsh 5.9 (x86_64-apple-darwin24.0)
Homebrew 4.4.27-3-gfaddb73

asdf plugins affected (if relevant)

java

@Stratus3D
Copy link
Member

@michelemadonna asdf set can be used to set any version of a tool. Setting a tool to a valid version that isn't installed is a pretty common pattern. Define all the tool versions you want to use for a project, then run asdf install to get everything installed.

I guess the question is here, do we want to suggest uninstalled versions differently than installed versions? It's understandable that some users may want to choose from a list of already installed versions.

@mhagnumdw
Copy link

I guess the question is here, do we want to suggest uninstalled versions differently than installed versions? It's understandable that some users may want to choose from a list of already installed versions.

Yes, that would be a good thing.

@michelemadonna
Copy link
Author

@Stratus3D

I guess the question is here, do we want to suggest uninstalled versions differently than installed versions? It's understandable that some users may want to choose from a list of already installed versions.

The previous implementation was designed as an efficient way to switch between already installed versions of a tool on the system. This was particularly useful for users who wanted a quick way to work with available versions without dealing with uninstalled ones.

Additionally, the asdf set command does not currently install any uninstalled versions of the selected tool. This reinforces its role as a simple switch for existing installations rather than a mechanism for defining and fetching versions not yet present.

While suggesting uninstalled versions might be beneficial in some cases, it's important to consider that many users expect to select only from what's already installed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants