skywind3000 / skywind3000/z.lua

Lose order of the completions problem

Open
#140 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Lua
Stars
3.1k
Forks
148
PR merge metrics
No merged PRs in 30d

Description

https://github.com/skywind3000/z.lua/blob/a3d4f5db684ed6dfd3041e73d1d761f5fe944179/z.lua#L2243

_describe helper will lose the order of completion from zlua, suggest change it to code below for remain the completions order

compadd -U -V zlua "${(@)completions}"

and I'm looking for a way to make z complete like cd when zlua's output is empty:

_zlua_zsh_tab_completion() {
    (( $+compstate )) && compstate[insert]=menu
    local completions=(${(f)"$(_zlua --complete "${words/_zlua/z}")"})


    if [[ ${#completions[@]} == 0 ]]; then
        _files -/
    else
        compadd -U -V zlua "${(@)completions}"
    fi
}

hope @skywind3000 can handle the code merge

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at z.lua around line 2243 and inspect the _describe helper used for zsh completion. Compare its completion handling with the proposed zsh function, including the empty-output fallback to _files -/. Done means completion order is preserved and z can fall back to directory completion when zlua returns no results.

Written by the indexing model from the issue text.

Assessment

Tech stack
lua, zsh
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.