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:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user