Skip to content

Fix ZSH autocommpletions#1

Merged
spkane merged 1 commit intospkane:completions-global-supportfrom
hposca:fix-zsh-completions
Jan 6, 2026
Merged

Fix ZSH autocommpletions#1
spkane merged 1 commit intospkane:completions-global-supportfrom
hposca:fix-zsh-completions

Conversation

@hposca
Copy link

@hposca hposca commented Jan 6, 2026

Working autocomplete for ZSH

With the help of ClaudeAI (and lots of patience)

Now just -g <TAB> is working as expected including for modules, so one can run just -g mod<TAB> and it will be autocompleted to just -g module:: and you can then just -g module::<TAB> to see all the available recipes.

Summary by CodeRabbit

  • Bug Fixes
    • Fixed shell completions across Bash, Fish, Elvish, Zsh, PowerShell, and Nushell to properly support the -g/--global-justfile flag, ensuring recipes and variables are correctly completed when using a global justfile.

✏️ Tip: You can customize this high-level summary in your review settings.

With the help of ClaudeAI (and lots of patience)

Now `just -g <TAB>` is working as expected including for modules, so one
can run `just -g mod<TAB>` and it will be autocompleted to `just -g
module::` and you can then `just -g module::<TAB>` to see all the
available recipes.
@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Caution

Review failed

Failed to post review comments

📝 Walkthrough

Walkthrough

This change introduces runtime detection and propagation of the -g/--global-justfile flag across shell completion scripts (Bash, Fish, Elvish, Nu, PowerShell, Zsh) and the Rust completions module, ensuring recipe lookups and variable queries respect the specified justfile context.

Changes

Cohort / File(s) Summary
Shell Completion Scripts — Flag Detection & Propagation
completions/just.bash, completions/just.fish, completions/just.elvish, completions/just.nu, completions/just.powershell, completions/just.zsh
Each script now detects the -g/--global-justfile flag in command-line arguments and stores it in a use_global variable. This flag is then propagated to all just invocations for summary, recipe, and variable lookups, ensuring completions respect the global justfile setting. Nu script adds context parameter to completion function signature.
Rust Completions Module
src/completions.rs
Extends completion script generation to handle global justfile flag detection across all shell types. Introduces ELVISH_COMPLETION_REPLACEMENTS constant alongside existing shell-specific replacement constants, and updates logic to detect -g/--global-justfile in command words, passing the flag to just summary, list, and variables invocations.

Sequence Diagram(s)

sequenceDiagram
    participant User as User / Shell
    participant Script as Completion Script
    participant Just as Just Binary

    rect rgb(220, 240, 220)
    Note over User,Just: Previous Behavior (Default Justfile Only)
    User->>Script: Complete recipe (possibly with -g flag)
    Script->>Just: just --summary
    Just->>Just: Search local justfile only
    Just-->>Script: Recipe list
    Script-->>User: Completion candidates
    end

    rect rgb(240, 240, 220)
    Note over User,Just: New Behavior (Global Justfile Aware)
    User->>Script: Complete recipe with -g/--global-justfile
    Script->>Script: Detect -g/--global-justfile in args
    alt Global flag detected
        Script->>Just: just --global-justfile --summary
        Just->>Just: Search global justfile
    else No global flag
        Script->>Just: just --summary
        Just->>Just: Search local justfile
    end
    Just-->>Script: Recipe list (respecting context)
    Script-->>User: Completion candidates
    end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Poem

🐰 A rabbit's ode to global justfiles so fine,
Five shells now know which recipes to align,
With flags propagated through bash, fish, and zsh,
Completions now work—no more logic mismash!
From nu to powershell, each one plays its part, 🌍✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix ZSH autocommpletions' is related to the changeset but only partially captures the main change. While ZSH is addressed, the PR actually adds comprehensive global-justfile support across multiple shells (Bash, Fish, Elvish, Zsh, PowerShell), with ZSH being only one component.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@hposca hposca changed the base branch from master to completions-global-support January 6, 2026 16:26
@spkane
Copy link
Owner

spkane commented Jan 6, 2026

@coderabbitai generate docstrings

@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

✅ Actions performed

Initiated docstring generation; will generate only if new commits exist.

@coderabbitai
Copy link

coderabbitai bot commented Jan 6, 2026

Caution

Docstrings generation - FAILED

No docstrings were generated.

@spkane spkane merged commit 7910d2f into spkane:completions-global-support Jan 6, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants