mirror of
https://github.com/microsoft/vscode.git
synced 2026-09-14 07:12:00 +01:00
First sketch for a simple API that lets extensions render content in chat using a webview Right now this is targeting results from tool calls but we could potentially extend this to work with a more generic version of our chat response image part
40 lines
2.2 KiB
TypeScript
40 lines
2.2 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import { Disposable } from '../../../base/common/lifecycle.js';
|
|
import { IInstantiationService } from '../../../platform/instantiation/common/instantiation.js';
|
|
import { MainThreadCustomEditors } from './mainThreadCustomEditors.js';
|
|
import { MainThreadWebviewPanels } from './mainThreadWebviewPanels.js';
|
|
import { MainThreadWebviews } from './mainThreadWebviews.js';
|
|
import { MainThreadWebviewsViews } from './mainThreadWebviewViews.js';
|
|
import * as extHostProtocol from '../common/extHost.protocol.js';
|
|
import { extHostCustomer, IExtHostContext } from '../../services/extensions/common/extHostCustomers.js';
|
|
import { MainThreadChatOutputRenderer } from './mainThreadChatOutputRenderer.js';
|
|
|
|
@extHostCustomer
|
|
export class MainThreadWebviewManager extends Disposable {
|
|
constructor(
|
|
context: IExtHostContext,
|
|
@IInstantiationService instantiationService: IInstantiationService,
|
|
) {
|
|
super();
|
|
|
|
const webviews = this._register(instantiationService.createInstance(MainThreadWebviews, context));
|
|
context.set(extHostProtocol.MainContext.MainThreadWebviews, webviews);
|
|
|
|
const webviewPanels = this._register(instantiationService.createInstance(MainThreadWebviewPanels, context, webviews));
|
|
context.set(extHostProtocol.MainContext.MainThreadWebviewPanels, webviewPanels);
|
|
|
|
const customEditors = this._register(instantiationService.createInstance(MainThreadCustomEditors, context, webviews, webviewPanels));
|
|
context.set(extHostProtocol.MainContext.MainThreadCustomEditors, customEditors);
|
|
|
|
const webviewViews = this._register(instantiationService.createInstance(MainThreadWebviewsViews, context, webviews));
|
|
context.set(extHostProtocol.MainContext.MainThreadWebviewViews, webviewViews);
|
|
|
|
const chatOutputRenderers = this._register(instantiationService.createInstance(MainThreadChatOutputRenderer, context, webviews));
|
|
context.set(extHostProtocol.MainContext.MainThreadChatOutputRenderer, chatOutputRenderers);
|
|
}
|
|
}
|