Skip to content

fix(completion): scope completion to the current simple command - #1337

Draft
reubeno wants to merge 1 commit into
mainfrom
complete-sep
Draft

reubeno wants to merge 1 commit into
mainfrom
complete-sep

Conversation

@reubeno

@reubeno reubeno commented Sep 2, 2026

Copy link
Copy Markdown
Owner

COMP_WORDS/COMP_LINE/COMP_CWORD and the command-name lookup covered the whole input line, so echo foo; X=1 cmd <Tab> looked up completions for echo. Like bash, start after the last command separator and skip leading variable assignments.

Assisted-By: Claude Fable 5.1 noreply@anthropic.com

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Test Results

    5 files     49 suites   21m 28s ⏱️
2 950 tests 2 950 ✅ 0 💤 0 ❌
9 149 runs  9 149 ✅ 0 💤 0 ❌

Results for commit b9ae138.

♻️ This comment has been updated with latest results.

@github-actions

github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown

Performance Benchmark Report

Benchmark name Baseline (μs) Test/PR (μs) Delta (μs) Delta %
clone_shell_object 13.18 μs 13.62 μs 0.45 μs 🟠 +3.39%
eval_arithmetic 0.11 μs 0.11 μs -0.00 μs ⚪ Unchanged
expand_one_string 1.22 μs 1.22 μs 0.00 μs ⚪ Unchanged
for_loop 20.12 μs 20.22 μs 0.10 μs ⚪ Unchanged
full_peg_complex 40.37 μs 40.36 μs -0.01 μs ⚪ Unchanged
full_peg_for_loop 4.48 μs 4.46 μs -0.02 μs ⚪ Unchanged
full_peg_nested_expansions 11.64 μs 11.64 μs 0.00 μs ⚪ Unchanged
full_peg_pipeline 3.00 μs 3.01 μs 0.01 μs ⚪ Unchanged
full_peg_simple 1.21 μs 1.22 μs 0.01 μs ⚪ Unchanged
function_call 2.51 μs 2.53 μs 0.02 μs ⚪ Unchanged
instantiate_shell 39.45 μs 39.87 μs 0.42 μs ⚪ Unchanged
instantiate_shell_with_init_scripts 18609.65 μs 18834.82 μs 225.17 μs ⚪ Unchanged
parse_peg_bash_completion 1604.04 μs 1588.62 μs -15.41 μs ⚪ Unchanged
parse_peg_complex 12.60 μs 12.51 μs -0.08 μs ⚪ Unchanged
parse_peg_for_loop 1.29 μs 1.26 μs -0.04 μs ⚪ Unchanged
parse_peg_pipeline 1.44 μs 1.43 μs -0.01 μs ⚪ Unchanged
parse_peg_simple 0.73 μs 0.74 μs 0.00 μs ⚪ Unchanged
run_echo_builtin_command 8.83 μs 8.86 μs 0.04 μs ⚪ Unchanged
tokenize_sample_script 2.50 μs 2.56 μs 0.06 μs ⚪ Unchanged

Code Coverage Report: Only Changed Files listed

Package Base Coverage New Coverage Difference
brush-core/src/completion.rs 🟠 74.32% 🟢 76.81% 🟢 2.49%
brush-core/src/extendedtests.rs 🟠 75% 🟢 75.76% 🟢 0.76%
brush-core/src/openfiles.rs 🟠 64.15% 🟠 64.62% 🟢 0.47%
brush-core/src/regex.rs 🟢 99.17% 🟢 100% 🟢 0.83%
brush-core/src/results.rs 🟢 80.16% 🟢 80.62% 🟢 0.46%
brush-core/src/shell.rs 🟢 94.78% 🟢 95.38% 🟢 0.6%
brush-core/src/shell/prompts.rs 🟢 97.62% 🟢 97.37% 🔴 -0.25%
brush-core/src/wellknownvars.rs 🟢 84.53% 🟢 84.72% 🟢 0.19%
brush-interactive/src/interactive_shell.rs 🟠 65.67% 🟠 68.51% 🟢 2.84%
brush-parser/src/parser/peg.rs 🟢 95.39% 🟢 95.42% 🟢 0.03%
brush-shell/src/config.rs 🟢 95.77% 🟢 95.65% 🔴 -0.12%
brush-shell/src/entry.rs 🟢 91.1% 🟢 92.74% 🟢 1.64%
xtask/src/e2e.rs 🔴 0% 🟠 57.98% 🟢 57.98%
Overall Coverage 🟢 77.54% 🟢 77.23% 🔴 -0.31%

Minimum allowed coverage is 70%, this run produced 77.23%
Maximum allowed coverage difference is -5%, this run produced -0.31%

Test Summary: bash-completion test suite

Outcome Count Percentage
✅ Pass 1586 75.20
❗️ Error 18 0.85
❌ Fail 151 7.16
⏩ Skip 339 16.07
❎ Expected Fail 13 0.62
✔️ Unexpected Pass 2 0.09
📊 Total 2109 100.00

COMP_WORDS/COMP_LINE/COMP_CWORD and the command-name lookup covered the
whole input line, so `echo foo; X=1 cmd <Tab>` looked up completions
for echo. Like bash, start after the last command separator and skip
leading variable assignments.

Assisted-By: Claude Fable 5.1 <noreply@anthropic.com>
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.

1 participant