Skip to content

Extend nested module completion fixes to zsh, bash, fish, PowerShell, and Nushell#3112

Closed
kitsuyui wants to merge 5 commits intocasey:masterfrom
kitsuyui:inspect-other-shell-module-completion
Closed

Extend nested module completion fixes to zsh, bash, fish, PowerShell, and Nushell#3112
kitsuyui wants to merge 5 commits intocasey:masterfrom
kitsuyui:inspect-other-shell-module-completion

Conversation

@kitsuyui
Copy link
Copy Markdown

@kitsuyui kitsuyui commented Mar 8, 2026

This PR builds on the work in #3111 and further addresses #2912 for other shells.

The original zsh fix in #3111 resolved nested module completion by tracking the current module path and completing against the current module level instead of stopping after the first segment. This branch applies the same idea to additional shells that showed the same behavior.

Shells updated in this PR:

  • bash
  • fish
  • PowerShell
  • Nushell

What changed:

  • bash: complete nested module names and recipes based on the current module path
  • fish: complete nested module names and recipes with module-aware runtime completion
  • PowerShell: resolve the current module path during completion and avoid invalid justfile-path handling
  • Nushell: traverse nested modules from the current completion context instead of only looking at top-level recipes

Tests:

  • added or extended regression coverage for bash, fish, PowerShell, and Nushell
  • verified with cargo test completions -- --nocapture

This is intended as a follow-up to #3111, using the same approach for shells that still exhibited the module-completion problem described in #2912.

Resolve the current module path during zsh completion so completion can
continue inside nested modules instead of stopping after the first module
segment. Add a zsh regression test covering nested module recipes.
Resolve the current module path during bash completion so nested module
recipes can be completed level by level. Add regression fixtures and tests
covering nested module names and recipes.
Complete module names and nested module recipes in fish based on the current
module path, and add a regression test that exercises nested module
completion with complete -C.
Resolve the current module path for PowerShell completion, guard optional
justfile handling, and add a TabExpansion2 regression test for nested module
completion.
Traverse nested modules from the current completion context in Nushell, and
add a completion test that checks root, module, and nested recipe matches.
@kitsuyui kitsuyui force-pushed the inspect-other-shell-module-completion branch from ef7580d to 2a6011a Compare March 17, 2026 10:09
@casey
Copy link
Copy Markdown
Owner

casey commented Mar 22, 2026

I switched to using Clap's dynamic completion engine in #3167. The new completion engine calls into the just binary to get completions. This allows us to implement custom completion logic in Rust for all supported shells, instead of having to patch in support for each individual shell.

I created #2406 to track improvements to the new completion engine in one place.

The new completion engine partially fixes this by completing :: separated recipe paths, and there's a note in the above issue that we should make it work with space-separated paths.

@casey casey closed this Mar 22, 2026
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