fix(vscode): complete slash commands with tab #2468
All Vouch review confidence checks passed
Residual risk 0.29 = Change Risk (0.52) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 400 lines diff across 5 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.359
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #2468"
general
weight: 0.35
ousamabenyounes
Fixes #2295.
Summary
Review follow-up
Both review comments were addressed in
8045b5b:selectedIndexwas only reset when the menu's visibility changed, so typing more characters could leave it pointing past the end of the shrunken list: the lookup returnedundefinedwhile the key was still swallowed, leaving the menu open without completing anything. The index is now reset when the filtered list changes identity, with a clamp as a same-render guard. The clamp alone was not sufficient — after narrowing and then widening the query again, the unclamped backing state resurfaced and the selection jumped back to the stale index, which now has its own test.slash-menu-action.tsis removed and the Tab/Enter branch is inlined intohandleSlashMenuKeythrough a sharedcase, per the step-down rule in AGENTS.md.Rebase onto latest main
Rebased onto the current
mainto clear a merge conflict that had made the PR unmergeable. The only conflict was inInputArea.tsx:mainhas since replaced theuseMemoizedFn(...)wrappers with plainfunctiondeclarations and madeadjustHeighttake a requiredtextareaargument. The completion handler was adapted to match —handleSlashCommandCompletionis now a plainfunctionand callsadjustHeight(textareaRef.current).Test verification (RED → GREEN)
RED — the four selection-bounds behaviours fail on the previous commit, with the new tests applied to otherwise unmodified code:
GREEN — after the fix:
Coverage on the changed production lines of
useSlashMenu.tsis 100%.Full local validation for the affected package (
kimi-code/ apps/vscode): lint + sherif, typecheck (extension + webview), tests on both the v2 and legacy v1 engines (355 → 361 passing), and the production build all pass.AI assistance disclosure
This patch and PR text were AI-assisted. The implementation was exercised with targeted regression tests and the complete local validation suite; the human contributor remains responsible for reviewing and understanding the submitted changes.