Skip to content

Commit 5f8e69f

Browse files
committed
get it to work
1 parent 9aacad6 commit 5f8e69f

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/vs/base/browser/ui/tree/abstractTree.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ class TreeNodeList<T, TFilterData, TRef> extends List<ITreeNode<T, TFilterData>>
14911491

14921492
override setFocus(indexes: number[], browserEvent?: UIEvent, fromAPI = false): void {
14931493
super.setFocus(indexes, browserEvent);
1494-
1494+
console.log('fromApi', fromAPI, browserEvent);
14951495
if (!fromAPI) {
14961496
this.focusTrait.set(indexes.map(i => this.element(i)), browserEvent);
14971497
}

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

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ 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 { ICommandService } from 'vs/platform/commands/common/commands';
4645

4746
// Register configuration
4847
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
@@ -134,7 +133,6 @@ class ChatAccessibileViewContribution extends Disposable {
134133
const codeEditorService = accessor.get(ICodeEditorService);
135134
const editor = codeEditorService.getActiveCodeEditor() || codeEditorService.getFocusedCodeEditor();
136135
const widgetService = accessor.get(IChatWidgetService);
137-
const commandService = accessor.get(ICommandService);
138136
const editorUri = editor?.getModel()?.uri;
139137
const widget: IChatWidget | undefined = widgetService.lastFocusedWidget;
140138
const focused = widget?.getFocus();
@@ -160,8 +158,7 @@ class ChatAccessibileViewContribution extends Disposable {
160158
id: 'chat',
161159
provideContent,
162160
onClose() {
163-
widget.reveal(focused);
164-
commandService.executeCommand('chat.action.focus');
161+
widget.reveal(focused, true);
165162
},
166163
onKeyDown(e: IKeyboardEvent) {
167164

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

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

379-
reveal(item: ChatTreeItem): void {
379+
reveal(item: ChatTreeItem, focus?: boolean): void {
380380
this.tree.reveal(item);
381+
if (focus) {
382+
const items = this.tree.getNode(null).children;
383+
const node = items.find(i => i.element?.id === item.id);
384+
if (!node) {
385+
return;
386+
}
387+
388+
this.tree.setFocus([node.element]);
389+
this.tree.domFocus();
390+
}
381391
}
382392

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

0 commit comments

Comments
 (0)