fix (vscode): focus chat input after opening the chat view

Opens the chat view before focusing the input
Routes a new webview command to focus the composer
Refocuses the input after adding a VS Code selection attachment
This commit is contained in:
Bohdan Triapitsyn
2026-08-13 23:50:54 +03:00
parent 2a5be62c58
commit 1b02310a28
3 changed files with 24 additions and 2 deletions
+12
View File
@@ -200,6 +200,18 @@ export class ChatViewProvider implements vscode.WebviewViewProvider {
}
}
public focusChatInput(): void {
if (!this._view) {
return;
}
this._view.show(true);
void this._view.webview.postMessage({
type: 'command',
command: 'focusChatInput',
});
}
public addContextSelection(selection: { filePath: string; filename: string; text: string }) {
if (!this._view) {
return;
+4 -1
View File
@@ -182,7 +182,10 @@ export async function activate(context: vscode.ExtensionContext) {
context.subscriptions.push(
vscode.commands.registerCommand('openchamber.focusChat', async () => {
await vscode.commands.executeCommand('openchamber.chatView.focus');
if (!(await revealChatViewForPayload())) {
return;
}
chatViewProvider?.focusChatInput();
})
);