Path: blob/main/extensions/copilot/src/platform/notification/common/notificationService.ts
13401 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 { createServiceIdentifier } from '../../../util/common/services';6import { CancellationToken } from '../../../util/vs/base/common/cancellation';78export interface MessageOptions {9modal?: boolean;10detail?: string;11}1213export interface ProgressOptions {14location: ProgressLocation | {15viewId: string;16};17title?: string;18cancellable?: boolean;19}2021export enum ProgressLocation {22SourceControl = 1,23Window = 10,24Notification = 1525}2627export interface Progress<T> {28report(value: T): void;29}3031export interface INotificationService {32readonly _serviceBrand: undefined;3334showInformationMessage(message: string, ...items: string[]): Promise<string | undefined>;35showInformationMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Promise<T | undefined>;36showWarningMessage(message: string, ...items: string[]): Promise<string | undefined>;37showQuotaExceededDialog(options: { isNoAuthUser: boolean }): Promise<unknown>;38withProgress<R>(options: ProgressOptions, task: (progress: Progress<{39message?: string;40increment?: number;41}>, token: CancellationToken) => Thenable<R>): Promise<R>;42}4344export class NullNotificationService implements INotificationService {45declare readonly _serviceBrand: undefined;4647showInformationMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Promise<T | undefined>;48showInformationMessage(message: string, ...items: string[]): Promise<string | undefined>;49showInformationMessage<T extends string>(message: string, options: MessageOptions, ...items: T[]): Promise<T | undefined>;50showInformationMessage(message: string, optionsOrItem?: any, ...items: any[]): Promise<any> {51return Promise.resolve(undefined);52}5354showWarningMessage(message: string, ...items: string[]): Promise<string | undefined> {55return Promise.resolve(undefined);56}5758showQuotaExceededDialog(options: { isNoAuthUser: boolean }): Promise<unknown> {59return Promise.resolve();60}6162withProgress<R>(options: ProgressOptions, task: (progress: Progress<{63message?: string;64increment?: number;65}>, token: CancellationToken) => Thenable<R>): Promise<R> {66return Promise.resolve(task({ report: () => { } }, CancellationToken.None));67}68}6970export const INotificationService = createServiceIdentifier<INotificationService>('INotificationService');717273