This commit is contained in:
Johannes
2024-03-18 14:18:32 +01:00
parent 45f50d555e
commit 8db31dfc5d
4 changed files with 32 additions and 10 deletions

View File

@@ -27,6 +27,8 @@ import { IEditorService } from 'vs/workbench/services/editor/common/editorServic
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
import { DEFAULT_EDITOR_ASSOCIATION } from 'vs/workbench/common/editor';
import { IChatService, InteractiveSessionVoteDirection } from 'vs/workbench/contrib/chat/common/chatService';
import { ChatAgentLocation, IChatAgentService } from 'vs/workbench/contrib/chat/common/chatAgents';
import { nullExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
type SessionData = {
editor: ICodeEditor;
@@ -66,6 +68,7 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
@IInstantiationService private readonly _instaService: IInstantiationService,
@IEditorService private readonly _editorService: IEditorService,
@IChatService private readonly _chatService: IChatService,
@IChatAgentService private readonly _chatAgentService: IChatAgentService,
) {
const mapping = this._store.add(new DisposableMap<IInlineChatSessionProvider>());
@@ -151,7 +154,7 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
this._logService.trace(`[IE] creating NEW session for ${editor.getId()}, ${provider.debugName}`);
this._store.add(this._chatService.onDidPerformUserAction(e => {
store.add(this._chatService.onDidPerformUserAction(e => {
if (e.sessionId !== chatModel.sessionId) {
return;
}
@@ -171,6 +174,20 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
}
}));
store.add(this._chatAgentService.registerDynamicAgent({
id: provider.debugName,
extensionId: nullExtensionDescription.identifier,
isDefault: true,
locations: [ChatAgentLocation.Editor],
defaultImplicitVariables: [],
metadata: { isSticky: true },
slashCommands: []
}, {
async invoke(request, progress, history, token) {
return {};
},
}));
store.add(this._inlineChatService.onDidChangeProviders(e => {
if (e.removed === provider) {
this._logService.trace(`[IE] provider GONE for ${editor.getId()}, ${provider.debugName}`);