Skip to content

Commit

Permalink
fixup ChatRequestNotebookData (#219331)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jul 1, 2024
1 parent d3035ba commit ea03089
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/vs/workbench/api/common/extHost.api.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostUriOpeners = rpcProtocol.set(ExtHostContext.ExtHostUriOpeners, new ExtHostUriOpeners(rpcProtocol));
const extHostProfileContentHandlers = rpcProtocol.set(ExtHostContext.ExtHostProfileContentHandlers, new ExtHostProfileContentHandlers(rpcProtocol));
rpcProtocol.set(ExtHostContext.ExtHostInteractive, new ExtHostInteractive(rpcProtocol, extHostNotebook, extHostDocumentsAndEditors, extHostCommands, extHostLogService));
const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostLogService, extHostCommands, extHostDocuments, extHostNotebook));
const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostLogService, extHostCommands, extHostDocuments));
const extHostChatVariables = rpcProtocol.set(ExtHostContext.ExtHostChatVariables, new ExtHostChatVariables(rpcProtocol));
const extHostLanguageModelTools = rpcProtocol.set(ExtHostContext.ExtHostLanguageModelTools, new ExtHostLanguageModelTools(rpcProtocol));
const extHostAiRelatedInformation = rpcProtocol.set(ExtHostContext.ExtHostAiRelatedInformation, new ExtHostRelatedInformation(rpcProtocol));
Expand Down
8 changes: 3 additions & 5 deletions src/vs/workbench/api/common/extHostChatAgents2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import { ILogService } from 'vs/platform/log/common/log';
import { ExtHostChatAgentsShape2, IChatAgentCompletionItem, IChatAgentHistoryEntryDto, IChatProgressDto, IExtensionChatAgentMetadata, IMainContext, MainContext, MainThreadChatAgentsShape2 } from 'vs/workbench/api/common/extHost.protocol';
import { CommandsConverter, ExtHostCommands } from 'vs/workbench/api/common/extHostCommands';
import { ExtHostDocuments } from 'vs/workbench/api/common/extHostDocuments';
import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook';
import * as typeConvert from 'vs/workbench/api/common/extHostTypeConverters';
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
import { ChatAgentLocation, IChatAgentRequest, IChatAgentResult } from 'vs/workbench/contrib/chat/common/chatAgents';
Expand Down Expand Up @@ -266,8 +265,7 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS
mainContext: IMainContext,
private readonly _logService: ILogService,
private readonly _commands: ExtHostCommands,
private readonly _documents: ExtHostDocuments,
private readonly _notebooks: ExtHostNotebookController
private readonly _documents: ExtHostDocuments
) {
super();
this._proxy = mainContext.getProxy(MainContext.MainThreadChatAgents2);
Expand Down Expand Up @@ -323,8 +321,8 @@ export class ExtHostChatAgents2 extends Disposable implements ExtHostChatAgentsS

} else if (request.locationData?.type === ChatAgentLocation.Notebook) {
// notebook data
const notebook = this._notebooks.getNotebookDocument(request.locationData.sessionInputUri);
location2 = new extHostTypes.ChatRequestNotebookData(notebook.apiNotebook);
const cell = this._documents.getDocument(request.locationData.sessionInputUri);
location2 = new extHostTypes.ChatRequestNotebookData(cell);

} else if (request.locationData?.type === ChatAgentLocation.Terminal) {
// TBD
Expand Down
6 changes: 3 additions & 3 deletions src/vs/workbench/api/common/extHostTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4449,17 +4449,17 @@ export enum ChatLocation {
Editor = 4,
}

export class ChatRequestEditorData {
export class ChatRequestEditorData implements vscode.ChatRequestEditorData {
constructor(
readonly document: vscode.TextDocument,
readonly selection: vscode.Selection,
readonly wholeRange: vscode.Range,
) { }
}

export class ChatRequestNotebookData {
export class ChatRequestNotebookData implements vscode.ChatRequestNotebookData {
constructor(
readonly notebook: vscode.NotebookDocument
readonly cell: vscode.TextDocument
) { }
}

Expand Down
4 changes: 2 additions & 2 deletions src/vscode-dts/vscode.proposed.chatParticipantPrivate.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ declare module 'vscode' {

export class ChatRequestNotebookData {
//TODO@API should be the editor
notebook: NotebookDocument;
readonly cell: TextDocument;

constructor(notebook: NotebookDocument);
constructor(cell: TextDocument);
}

export interface ChatRequest {
Expand Down

0 comments on commit ea03089

Please sign in to comment.