Skip to content

Commit bc15ede

Browse files
authored
fix: ensure chat view is revealed when attaching context (microsoft#213871)
1 parent 61953c1 commit bc15ede

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

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

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ import { Iterable } from 'vs/base/common/iterator';
1111
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
1212
import { URI } from 'vs/base/common/uri';
1313
import { Location } from 'vs/editor/common/languages';
14-
import { IChatWidgetService } from 'vs/workbench/contrib/chat/browser/chat';
14+
import { IChatWidgetService, showChatView } from 'vs/workbench/contrib/chat/browser/chat';
1515
import { ChatDynamicVariableModel } from 'vs/workbench/contrib/chat/browser/contrib/chatDynamicVariables';
1616
import { ChatAgentLocation } from 'vs/workbench/contrib/chat/common/chatAgents';
1717
import { IChatModel, IChatRequestVariableData, IChatRequestVariableEntry } from 'vs/workbench/contrib/chat/common/chatModel';
1818
import { ChatRequestDynamicVariablePart, ChatRequestVariablePart, IParsedChatRequest } from 'vs/workbench/contrib/chat/common/chatParserTypes';
1919
import { IChatContentReference } from 'vs/workbench/contrib/chat/common/chatService';
2020
import { IChatRequestVariableValue, IChatVariableData, IChatVariableResolver, IChatVariableResolverProgress, IChatVariablesService, IDynamicVariable } from 'vs/workbench/contrib/chat/common/chatVariables';
2121
import { ChatContextAttachments } from 'vs/workbench/contrib/chat/browser/contrib/chatContextAttachments';
22+
import { IViewsService } from 'vs/workbench/services/views/common/viewsService';
2223

2324
interface IChatData {
2425
data: IChatVariableData;
@@ -31,7 +32,8 @@ export class ChatVariablesService implements IChatVariablesService {
3132
private _resolver = new Map<string, IChatData>();
3233

3334
constructor(
34-
@IChatWidgetService private readonly chatWidgetService: IChatWidgetService
35+
@IChatWidgetService private readonly chatWidgetService: IChatWidgetService,
36+
@IViewsService private readonly viewsService: IViewsService,
3537
) {
3638
}
3739

@@ -155,6 +157,7 @@ export class ChatVariablesService implements IChatVariablesService {
155157
return;
156158
}
157159

160+
await showChatView(this.viewsService);
158161
const widget = this.chatWidgetService.lastFocusedWidget;
159162
if (!widget || !widget.viewModel) {
160163
return;

src/vs/workbench/contrib/chat/test/browser/chatVariables.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { IChatVariablesService } from 'vs/workbench/contrib/chat/common/chatVari
1919
import { MockChatWidgetService } from 'vs/workbench/contrib/chat/test/browser/mockChatWidget';
2020
import { MockChatService } from 'vs/workbench/contrib/chat/test/common/mockChatService';
2121
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
22+
import { TestViewsService } from 'vs/workbench/test/browser/workbenchTestServices';
2223
import { TestExtensionService, TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
2324

2425
suite('ChatVariables', function () {
@@ -28,7 +29,7 @@ suite('ChatVariables', function () {
2829
const testDisposables = ensureNoDisposablesAreLeakedInTestSuite();
2930

3031
setup(function () {
31-
service = new ChatVariablesService(new MockChatWidgetService());
32+
service = new ChatVariablesService(new MockChatWidgetService(), new TestViewsService());
3233
instantiationService = testDisposables.add(new TestInstantiationService());
3334
instantiationService.stub(IStorageService, testDisposables.add(new TestStorageService()));
3435
instantiationService.stub(ILogService, new NullLogService());

0 commit comments

Comments
 (0)