Skip to content

Commit 9aacad6

Browse files
committed
try something else
1 parent 9c534ef commit 9aacad6

File tree

2 files changed

+8
-16
lines changed

2 files changed

+8
-16
lines changed

src/vs/workbench/contrib/chat/browser/chat.contribution.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { IAccessibleViewService } from 'vs/workbench/contrib/accessibility/brows
4242
import { IKeyboardEvent } from 'vs/platform/keybinding/common/keybinding';
4343
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService';
4444
import { IChatResponseViewModel, isResponseVM } from 'vs/workbench/contrib/chat/common/chatViewModel';
45-
import { KeyCode } from 'vs/base/common/keyCodes';
45+
import { ICommandService } from 'vs/platform/commands/common/commands';
4646

4747
// Register configuration
4848
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
@@ -133,8 +133,9 @@ class ChatAccessibileViewContribution extends Disposable {
133133
const accessibleViewService = accessor.get(IAccessibleViewService);
134134
const codeEditorService = accessor.get(ICodeEditorService);
135135
const editor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
136-
const editorUri = editor?.getModel()?.uri;
137136
const widgetService = accessor.get(IChatWidgetService);
137+
const commandService = accessor.get(ICommandService);
138+
const editorUri = editor?.getModel()?.uri;
138139
const widget: IChatWidget | undefined = widgetService.lastFocusedWidget;
139140
const focused = widget?.getFocus();
140141
if (!widget || !focused) {
@@ -159,12 +160,11 @@ class ChatAccessibileViewContribution extends Disposable {
159160
id: 'chat',
160161
provideContent,
161162
onClose() {
162-
widget.reveal(focused, true);
163+
widget.reveal(focused);
164+
commandService.executeCommand('chat.action.focus');
163165
},
164166
onKeyDown(e: IKeyboardEvent) {
165-
if (e.keyCode === KeyCode.Escape) {
166-
widget.reveal(focused, true);
167-
}
167+
168168
},
169169
options: { ariaLabel: nls.localize('chatAccessibleView', "Chat Accessible View") }
170170
});

src/vs/workbench/contrib/chat/browser/chatWidget.ts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -376,16 +376,8 @@ export class ChatWidget extends Disposable implements IChatWidget {
376376
return withNullAsUndefined(this.tree.getFocus()[0]);
377377
}
378378

379-
reveal(item: ChatTreeItem, focus?: boolean): void {
380-
if (focus) {
381-
const itemToFocus = this.tree.getNode(null).children.find(i => i.element?.id === item.id);
382-
if (!itemToFocus) {
383-
return;
384-
}
385-
this.tree.setFocus([itemToFocus.element]);
386-
} else {
387-
this.tree.reveal(item);
388-
}
379+
reveal(item: ChatTreeItem): void {
380+
this.tree.reveal(item);
389381
}
390382

391383
async acceptInput(query?: string | IChatReplyFollowup): Promise<void> {

0 commit comments

Comments
 (0)