jdx/usage

zsh completion adds incorrect spaces

rrotter opened this issue · 1 comments

Describe the bug
zsh completion adds a space every time a partial completion is entered (most noticeably after "@" versions and "/" in paths), requiring deleting the space before continuing to type command

To Reproduce

  • use zsh
  • try completing the following commands:
    • type mise link node<tab> (completes to mise link node@ with trailing space)
    • type mise link node@18 /opt/homebr<tab> (completes to mise link node@18 /opt/homebrew with trailing space)

Expected behavior
above would complete to
mise link node@ no trailing space
mise link node@18 /opt/homebrew/ trailing slash, no trailing space

mise doctor output

version: 2024.5.16 macos-arm64 (2024-05-15)
activated: yes
shims_on_path: no

build_info: 
  Target: aarch64-apple-darwin
  Features: DEFAULT, NATIVE_TLS
  Built: Wed, 15 May 2024 04:59:00 +0000
  Rust Version: rustc 1.78.0 (9b00956e5 2024-04-29) (Homebrew)
  Profile: release

shell: 
  /bin/zsh
  zsh 5.9 (x86_64-apple-darwin23.0)

dirs: 
  data: ~/.local/share/mise
  config: ~/.config/mise
  cache: ~/Library/Caches/mise
  state: ~/.local/state/mise
  shims: ~/.local/share/mise/shims

config_files: 
  ~/.config/mise/config.toml

backends: 
  cargo
  go
  npm
  pipx
  ubi

plugins: 
  bun     (core)
  deno    (core)
  erlang  (core)
  go      (core)
  java    (core)
  jq      https://github.com/mise-plugins/asdf-jq.git#6d86d19
  node    (core)
  python  (core)
  ruby    (core)
  tiny    https://github.com/mise-plugins/mise-tiny.git#c532b14
  usage   https://github.com/jdx/mise-usage.git#fe3888a
  zig     (core)

toolset: 
  usage@0.2.0  
  ruby@3.2.4   

env_vars: 
  MISE_SHELL=zsh

settings: 
  activate_aggressive = false
  all_compile = false
  always_keep_download = false
  always_keep_install = false
  asdf_compat = false
  cargo_binstall = true
  color = true
  disable_default_shorthands = false
  disable_tools = []
  experimental = true
  go_default_packages_file = "~/.default-go-packages"
  go_download_mirror = "https://dl.google.com/go"
  go_repo = "https://github.com/golang/go"
  go_set_gopath = false
  go_set_goroot = true
  go_skip_checksum = false
  jobs = 4
  legacy_version_file = true
  legacy_version_file_disable_tools = []
  node_compile = false
  not_found_auto_install = true
  paranoid = false
  plugin_autoupdate_last_check_duration = "7d"
  python_default_packages_file = "/Users/rrotter/.default-python-packages"
  python_pyenv_repo = "https://github.com/pyenv/pyenv.git"
  raw = false
  trusted_config_paths = []
  quiet = false
  verbose = false
  yes = false
  ci = false
  debug = false
  trace = false
  log_level = "info"
  python_venv_auto_create = false

  [status]
  missing_tools = "if_other_versions_installed"
  show_env = false
  show_tools = false

No warnings found
No problems found

Additional context
I don't think there is anything remarkable about my .zshrc. No problems w/ completion on other commands, I'm not using omz or any other frameworks, just

fpath+=${HOMEBREW_PREFIX}/share/zsh/site-functions
fpath+=${HOMEBREW_PREFIX}/share/zsh-completions
autoload -Uz compinit && compinit
jdx commented

I'm seeing the same behavior, I think this somehow needs to be able to use _combination as some kind of parameter in the kdl config:

_arguments '*: :($(usage complete-word -s "$spec" -- "${words[@]}" ))'