[BUG] VS Code extension: Slash-command autocomplete traps history navigation
Steps to reproduce
- Send a few normal prompts, followed by any "/"-prefixed input that
gets recorded in history, then more normal prompts:
- "first test input"
- "second test input"
- /insights (any prompt starting with "/" works, valid OR
invalid — see Notes)
- "third test input"
- With the prompt box empty, press ↑ repeatedly to walk back through
history.
Actual
- ↑ walks back: "third test input" → /insights, and stops there.
- Once the input box contains the /insights entry, the slash-command
autocomplete UI appears (the "Slash commands" suggestion popup for
recognized commands, or "No matching commands" for unrecognized
ones), and arrow keys are captured by that popup.
- ↑ no longer goes further back to "second test input" / "first test input".
- ↓ no longer returns to "third test input" either, nor to the
in-progress empty input.
- The user is effectively pinned to the "/" entry until they manually
clear the input.
Root cause (suspected)
Whenever the prompt box content begins with "/", the slash-command
autocomplete UI takes over arrow key handling, regardless of whether
the content was typed by the user or populated by history navigation,
and regardless of whether the slash command is valid. History
navigation should bypass the autocomplete when the input was populated
from history, or the autocomplete should not capture ↑/↓ in that case.
Expected
- ↑/↓ walk through every history entry, including entries that begin
with "/", in chronological order.
- ↓ from the newest entry returns to the in-progress empty input.
- Slash-command autocomplete only activates for fresh user typing,
not when the input was populated by history navigation.
Notes
- Whether a "/"-prefixed prompt ends up in history depends on the
command:
- Locally-handled commands like /help and /status do NOT enter
history, so they cannot be used to reproduce this bug.
- Recognized commands sent to the model (e.g. /insights) enter
history and trigger the "Slash commands" suggestion popup.
- Unrecognized strings like /helpあああ or /unknowncmd also enter
history and trigger the "No matching commands" popup.
In both of the latter cases, the autocomplete UI captures the
arrow keys.
- This is the autocomplete-trap bug (#11265 / #10454) reached via a
new entry path: history navigation populating the input with a
recorded "/..." prompt, rather than the user typing "/" themselves.
#11265 was reported only against the CLI; this report covers the
VS Code extension, where the autocomplete UI is a separate
implementation.
- The follow-on symptom (↓ does not return to a newer history entry
or to the in-progress input) overlaps with #12664 (VS Code
extension, Windows, NOT_PLANNED but received +1s and "losing
prompts daily" comments before inactivity-autoclose).
- #32922 / #30429 are tangentially related (arrow keys at boundaries
destroy in-progress input) but describe a different symptom.
Environment
- Claude Code VS Code extension: anthropic.claude-code 2.1.132
- VS Code: 1.119.0
- OS: Windows 11 Pro 26200
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗