Sitelet https://github.com/casey/just/issues/3729
Skip to content

zsh completion: prefer recipes over files, and complete module recipes after a space #3729

Description

@rcdailey

I'm using just 1.58.0 with the dynamic zsh completion script (just --completions zsh). I'd like to ask for feedback on two completion changes before anything else. I realize completion improvements are tracked in #2406; the second item below overlaps with "Handle space-separated paths in arguments", but I didn't see the first one listed.

1. Recipes should win over files and directories

When a recipe and a directory share a name, the directory wins. Given this layout:

.
├── justfile   # recipe: http file service=""
└── http/

Typing just ht<Tab> completes to just http/ instead of just http. The generated _clap_dynamic_completer_just adds directory candidates with -S '/' alongside recipes, so zsh picks the directory form. In practice, when I type a partial word right after just, I almost always want a recipe. It would be nice if recipes (and modules) were offered first and file paths were only a fallback, or only offered in positions where a recipe argument is expected. #2961 asked for the same ordering in PowerShell.

2. just <module> <Tab> should list the module's recipes

With mod http, just http::<Tab> works, but just http <Tab> offers the root recipes and files again instead of http's recipes. Since just http sync is a valid way to invoke the recipe, I'd expect completion to follow the same form. The same applies to nested modules (just http deep <Tab>).

For reference, I wrote a local zsh completion function that does both, using just --dump --dump-format json to walk modules and count recipe parameters, so files are only offered once a recipe expects arguments. I'm not suggesting that approach for just itself (it's shell-specific, which #2406 moved away from), but it confirms the behavior is possible and works well for single-file, import, and mod layouts.

Is this something you'd want in the Rust completion logic? Happy to provide more details.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions