fix(parse): report next implicit clause argument - #1372
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Central YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe parser now derives ChangesClause-aware parsing
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Partial parsing now reports the active implicit clause argument, restoring its available choices and custom completions. The focused regression coverage supports merge readiness with no outstanding risk. Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
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. Comment |
Summary
Problem
The parser tracks
next_arg_idxagainstactive_args, which selectsclause.argsfor commandswith a clause. However,
record_stopresolved that index againstcmd.argsdirectly. Because acommand cannot declare both top-level arguments and a clause,
cmd.argsis empty for clausecommands.
As a result, parsing a bare command with an implicit clause incorrectly returned
ParseOutput::next_argasNone, even though the clause's first argument was ready to accept avalue. Completion relies on
next_arg, so it could not offer the argument's choices or invoke itscustom completer.
Fix
Resolve the stopping position through
active_args, matching the collection used bynext_arg_idxthroughout parsing. Ordinary command arguments retain the existing behavior, whileclause commands now return the corresponding argument from
clause.args. Update the cursor commentto describe both cases and cover the implicit-clause case with a focused regression test.
Testing
cargo test -p usage-lib --all-features a_partial_parse_reports_the_next_implicit_clause_argumentcargo test -p usage-lib --all-features parse::testsmise run lintmise run lint-fixSummary by CodeRabbit