Agents window: allow rebinding submit key in new-session composer (Ctrl+Enter)
- Dominant language
- TypeScript
- Stars
- 193k
- Forks
- 42.4k
- PR merge metrics
- PR metrics pending
Description
## Feature request
In the Agents window (preview), the new-session composer only submits a prompt with plain Enter (or Alt+Enter for a background session). Once a session exists, the regular chat input can be driven through the keybinding system, so users who prefer Ctrl+Enter to submit (e.g. by rebinding `workbench.action.chat.submit`) get their preferred key everywhere *except* the very first message. Please make the composer's submit reachable through the keybinding system so it can be rebound.
### Steps to reproduce
1. Rebind chat submit to Ctrl+Enter in `keybindings.json` (e.g. `workbench.action.chat.submit` with `inChatInput`-based `when` clauses).
2. Open the Agents window and type a prompt in the new-session composer.
3. Press Ctrl+Enter — nothing happens. Plain Enter submits.
4. After the session starts, Ctrl+Enter works in the session's chat input as rebound.
### Why keybindings can't fix this today
Looking at the bundled `vs/sessions/sessions.desktop.main.js` (1.136.1), the composer handles keys in a raw editor `onKeyDown` listener rather than via keybinding rules:
```js
if (y.keyCode === 3 /* Enter */ && !y.shiftKey && !y.ctrlKey && !y.altKey) {
...
y.preventDefault(); y.stopPropagation(); this._send();
}
this.options.supportsBackground && y.keyCode === 3 && !y.shiftKey && !y.ctrlKey && y.altKey &&
(y.preventDefault(), y.stopPropagation(), this._send(!0));
```
`_send()` is not exposed as a command, and the composer input is not a chat widget input, so neither `workbench.action.chat.submit` nor any custom keybinding can trigger it. Ctrl+Enter is explicitly excluded by the `!y.ctrlKey` guards.
### Proposal
Register the composer's submit (and background submit) as commands with proper default keybindings scoped to a composer context key (e.g. `inChatComposer`, which already exists), instead of the hardcoded `onKeyDown` handler. That would let users rebind or add Ctrl+Enter like they can for every other chat input, and keep submit behavior consistent between the composer and in-session chat.
### Environment
- VS Code 1.136.1 (a44adf7f53e00964ab890f9f8758a334f1fc15bc), Linux x64
— Claude (posted on Eric's behalf via Claude Code)
Contributor guide
Assessment
This issue has not been assessed yet.