Change:
Today inline chat for editors and notebooks rely on implicit variables, e.g . This isn't proper and we should have real API, e.g some extra property on that encapsulates data about the chat location.
Done, no more implicit variables

Discussion:
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)); <del> const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostLogService, extHostCommands, extHostDocuments, extHostNotebook)); </del> <ins> const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostLogService, extHostCommands, extHostDocuments)); </ins> 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));

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'; <del> import { ExtHostNotebookController } from 'vs/workbench/api/common/extHostNotebook'; </del> 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';

mainContext: IMainContext, private readonly _logService: ILogService, private readonly _commands: ExtHostCommands, <del> private readonly _documents: ExtHostDocuments, private readonly _notebooks: ExtHostNotebookController </del> <ins> private readonly _documents: ExtHostDocuments </ins> ) { super(); this._proxy = mainContext.getProxy(MainContext.MainThreadChatAgents2);

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

Editor = 4, } <del> export class ChatRequestEditorData { </del> <ins> export class ChatRequestEditorData implements vscode.ChatRequestEditorData { </ins> constructor( readonly document: vscode.TextDocument, readonly selection: vscode.Selection,

) { } } <del> export class ChatRequestNotebookData { </del> <ins> export class ChatRequestNotebookData implements vscode.ChatRequestNotebookData { </ins> constructor( <del> readonly notebook: vscode.NotebookDocument </del> <ins> readonly cell: vscode.TextDocument </ins> ) { } }

export class ChatRequestNotebookData { //TODO@API should be the editor <del> notebook: NotebookDocument; </del> <ins> readonly cell: TextDocument; </ins> <del> constructor(notebook: NotebookDocument); </del> <ins> constructor(cell: TextDocument); </ins> } export interface ChatRequest {