Describe the bug
When pressing Tab for shell completion in the Copilot CLI within VSCode's integrated terminal, completion is triggered correctly, but focus then shifts to the terminal tab panel, making it impossible to continue typing or select completion candidates.
This does not occur in external terminals (i tested on Windows Terminal). The issue is specific to the VSCode integrated terminal
Affected version
GitHub Copilot CLI 1.0.32
Steps to reproduce the behavior
- Open VSCode integrated terminal
- Launch Copilot CLI interactively (copilot)
- Type any partial input and press Tab
- Completion triggers but focus moves to the terminal tabs panel
Expected behavior
Pressing Tab should trigger shell completion and keep focus in the terminal, allowing the user to continue interacting with Copilot CLI without interruption. Focus should never move to the terminal tab panel as a result of pressing Tab during text input.
Additional context
caused on VSCode 1.115.0 / Windows 11 / WSL2 zsh
Verified: Not user-configuration related
Reproduced with a completely clean VSCode profile (no extensions, no user settings):
code --disable-extensions --user-data-dir "%TEMP%\vscode-test"
This confirms the issue is in VSCode's core terminal handling or Copilot CLI itself,
not caused by any user keybindings or extensions.
Root cause hypothesis
VSCode's integrated terminal determines whether to pass Tab to the PTY process or handle it as UI navigation based on OSC 133 shell integration sequences (prompt markers). Standard shells like zsh emit these sequences, so VSCode recognizes them as "waiting for input" and passes Tab through correctly.
Copilot CLI's TUI (built on Node.js readline/ink) does not emit OSC 133 sequences. As a result, VSCode cannot determine that the terminal is in an input-waiting state and falls back to UI navigation behavior — moving focus to the terminal tabs panel.
This was confirmed using VSCode's built-in Keyboard Shortcuts Troubleshooter:
[KeybindingService]: / Received keydown event - modifiers: [], code: Tab, keyCode: 9, key: Tab
[KeybindingService]: | Converted keydown event - modifiers: [], code: Tab, keyCode: 2 ('Tab')
In zsh, Tab only triggers "Soft dispatching keyboard event" (terminal handles it).
In Copilot CLI, an additional raw DOM keydown event ("Received keydown event") is fired after the soft dispatch, which VSCode intercepts and routes to tab panel navigation instead of the terminal.
Workaround
Add the following to VSCode keybindings.json to explicitly send Tab to the terminal process:
{
"key": "tab",
"command": "workbench.action.terminal.sendSequence",
"args": { "text": "\u0009" },
"when": "terminalFocus && !terminalTabFocus"
}
Related issues
- Similar terminal integration issues have been reported:
- These suggest that Copilot CLI's TUI layer may have opportunities to improve compatibility with terminal environments like VSCode.
Suggested fix
Emit OSC 133 shell integration sequences at appropriate points during Copilot CLI's interactive session, so VSCode (and other terminals that support shell integration) can correctly recognize the input-waiting state.
Describe the bug
When pressing Tab for shell completion in the Copilot CLI within VSCode's integrated terminal, completion is triggered correctly, but focus then shifts to the terminal tab panel, making it impossible to continue typing or select completion candidates.
This does not occur in external terminals (i tested on Windows Terminal). The issue is specific to the VSCode integrated terminal
Affected version
GitHub Copilot CLI 1.0.32
Steps to reproduce the behavior
Expected behavior
Pressing Tab should trigger shell completion and keep focus in the terminal, allowing the user to continue interacting with Copilot CLI without interruption. Focus should never move to the terminal tab panel as a result of pressing Tab during text input.
Additional context
caused on VSCode 1.115.0 / Windows 11 / WSL2 zsh
Verified: Not user-configuration related
Reproduced with a completely clean VSCode profile (no extensions, no user settings):
code --disable-extensions --user-data-dir "%TEMP%\vscode-test"This confirms the issue is in VSCode's core terminal handling or Copilot CLI itself,
not caused by any user keybindings or extensions.
Root cause hypothesis
VSCode's integrated terminal determines whether to pass Tab to the PTY process or handle it as UI navigation based on OSC 133 shell integration sequences (prompt markers). Standard shells like zsh emit these sequences, so VSCode recognizes them as "waiting for input" and passes Tab through correctly.
Copilot CLI's TUI (built on Node.js readline/ink) does not emit OSC 133 sequences. As a result, VSCode cannot determine that the terminal is in an input-waiting state and falls back to UI navigation behavior — moving focus to the terminal tabs panel.
This was confirmed using VSCode's built-in Keyboard Shortcuts Troubleshooter:
In zsh, Tab only triggers "Soft dispatching keyboard event" (terminal handles it).
In Copilot CLI, an additional raw DOM keydown event ("Received keydown event") is fired after the soft dispatch, which VSCode intercepts and routes to tab panel navigation instead of the terminal.
Workaround
Add the following to VSCode keybindings.json to explicitly send Tab to the terminal process:
{ "key": "tab", "command": "workbench.action.terminal.sendSequence", "args": { "text": "\u0009" }, "when": "terminalFocus && !terminalTabFocus" }Related issues
Suggested fix
Emit OSC 133 shell integration sequences at appropriate points during Copilot CLI's interactive session, so VSCode (and other terminals that support shell integration) can correctly recognize the input-waiting state.