Contributable chat context (#273736)

* Contributable chat context

* Copilot feedback

* Matt and Ben feedback

* Also resolve for resources

* Clean up API

* More polish

* Fix double context
This commit is contained in:
Alex Ross
2025-11-03 16:49:32 +01:00
committed by GitHub
parent 2de69be63f
commit 70de2c9318
20 changed files with 707 additions and 55 deletions

View File

@@ -114,6 +114,7 @@ import { ExtHostWebviewPanels } from './extHostWebviewPanels.js';
import { ExtHostWebviewViews } from './extHostWebviewView.js';
import { IExtHostWindow } from './extHostWindow.js';
import { IExtHostWorkspace } from './extHostWorkspace.js';
import { ExtHostChatContext } from './extHostChatContext.js';
export interface IExtensionRegistries {
mine: ExtensionDescriptionRegistry;
@@ -227,6 +228,7 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
const extHostLanguageModelTools = rpcProtocol.set(ExtHostContext.ExtHostLanguageModelTools, new ExtHostLanguageModelTools(rpcProtocol, extHostLanguageModels));
const extHostChatSessions = rpcProtocol.set(ExtHostContext.ExtHostChatSessions, new ExtHostChatSessions(extHostCommands, extHostLanguageModels, rpcProtocol, extHostLogService));
const extHostChatAgents2 = rpcProtocol.set(ExtHostContext.ExtHostChatAgents2, new ExtHostChatAgents2(rpcProtocol, extHostLogService, extHostCommands, extHostDocuments, extHostLanguageModels, extHostDiagnostics, extHostLanguageModelTools));
const extHostChatContext = rpcProtocol.set(ExtHostContext.ExtHostChatContext, new ExtHostChatContext(rpcProtocol));
const extHostAiRelatedInformation = rpcProtocol.set(ExtHostContext.ExtHostAiRelatedInformation, new ExtHostRelatedInformation(rpcProtocol));
const extHostAiEmbeddingVector = rpcProtocol.set(ExtHostContext.ExtHostAiEmbeddingVector, new ExtHostAiEmbeddingVector(rpcProtocol));
const extHostAiSettingsSearch = rpcProtocol.set(ExtHostContext.ExtHostAiSettingsSearch, new ExtHostAiSettingsSearch(rpcProtocol));
@@ -1279,6 +1281,10 @@ export function createApiFactoryAndRegisterActors(accessor: ServicesAccessor): I
},
encode(content: string, options?: { uri?: vscode.Uri; encoding?: string }) {
return extHostWorkspace.encode(content, options);
},
registerChatContextProvider(selector: vscode.DocumentSelector, id: string, provider: vscode.ChatContextProvider): vscode.Disposable {
checkProposedApiEnabled(extension, 'chatContextProvider');
return extHostChatContext.registerChatContextProvider(checkSelector(selector), `${extension.id}-${id}`, provider);
}
};