Path: blob/main/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcome.ts
4780 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { Emitter, Event } from '../../../../../base/common/event.js';6import { IMarkdownString } from '../../../../../base/common/htmlContent.js';7import { Disposable } from '../../../../../base/common/lifecycle.js';8import { ThemeIcon } from '../../../../../base/common/themables.js';9import { ContextKeyExpression } from '../../../../../platform/contextkey/common/contextkey.js';10import { Registry } from '../../../../../platform/registry/common/platform.js';1112export const enum ChatViewsWelcomeExtensions {13ChatViewsWelcomeRegistry = 'workbench.registry.chat.viewsWelcome',14}1516export interface IChatViewsWelcomeDescriptor {17readonly icon?: ThemeIcon;18readonly title: string;19readonly content: IMarkdownString;20readonly when: ContextKeyExpression;21}2223export interface IChatViewsWelcomeContributionRegistry {24readonly onDidChange: Event<void>;25get(): ReadonlyArray<IChatViewsWelcomeDescriptor>;26register(descriptor: IChatViewsWelcomeDescriptor): void;27}2829class ChatViewsWelcomeContributionRegistry extends Disposable implements IChatViewsWelcomeContributionRegistry {30private readonly descriptors: IChatViewsWelcomeDescriptor[] = [];31private readonly _onDidChange = this._register(new Emitter<void>());32public readonly onDidChange: Event<void> = this._onDidChange.event;3334public register(descriptor: IChatViewsWelcomeDescriptor): void {35this.descriptors.push(descriptor);36this._onDidChange.fire();37}3839public get(): ReadonlyArray<IChatViewsWelcomeDescriptor> {40return this.descriptors;41}42}4344export const chatViewsWelcomeRegistry = new ChatViewsWelcomeContributionRegistry();45Registry.add(ChatViewsWelcomeExtensions.ChatViewsWelcomeRegistry, chatViewsWelcomeRegistry);464748