import { CancellationToken } from "../../../../base/common/cancellation.js"; import { Disposable, IDisposable } from "../../../../base/common/lifecycle.js"; import { URI } from "../../../../base/common/uri.js"; import * as languages from "../../../../editor/common/languages.js"; import { IConfigurationService } from "../../../../platform/configuration/common/configuration.service.js"; import { ILogService } from "../../../../platform/log/common/log.service.js"; import { IExternalOpener, IExternalUriOpenContext, OpenInternalOptions } from "../../../../platform/opener/common/opener.js"; import { IOpenerService } from "../../../../platform/opener/common/opener.service.js"; import { IQuickInputService } from "../../../../platform/quickinput/common/quickInput.service.js"; import { IPreferencesService } from "../../../services/preferences/common/preferences.service.js"; import { IExternalUriOpenerService } from "./externalUriOpenerService.service.js"; export interface IExternalOpenerProvider { getOpeners(targetUri: URI): AsyncIterable; } export interface IExternalUriOpener { readonly id: string; readonly label: string; canOpen(uri: URI, token: CancellationToken): Promise; /** * @param href The link to open, after port forwarding, as written. Openers that pass it on as a * string should use it as is, because parsing it into a URI loses its encoding. */ openExternalUri(href: string, ctx: IExternalUriOpenContext, token: CancellationToken): Promise; } /** * A way to open a link, such as an external URI opener. */ export interface ILinkHandler { readonly id: string; readonly label: string; /** * Whether opening the link without choosing a handler uses this handler. */ readonly isDefault: boolean; open(options?: OpenInternalOptions): Promise; } export declare class ExternalUriOpenerService extends Disposable implements IExternalUriOpenerService, IExternalOpener { private readonly openerService; private readonly configurationService; private readonly logService; private readonly preferencesService; private readonly quickInputService; readonly _serviceBrand: undefined; private readonly _providers; constructor(openerService: IOpenerService, configurationService: IConfigurationService, logService: ILogService, preferencesService: IPreferencesService, quickInputService: IQuickInputService); registerExternalOpenerProvider(provider: IExternalOpenerProvider): IDisposable; openExternal(href: string, ctx: IExternalUriOpenContext & { preferredOpenerId?: string; }, token: CancellationToken): Promise; getOpener(targetUri: URI, ctx: { sourceUri: URI; }, token: CancellationToken): Promise; getLinkHandlers(href: string, token: CancellationToken): Promise; /** * The opener that the caller or the user's settings ask for. It is used without checking `canOpen`. */ private getRequestedOpener; /** * The openers that can open the uri, best first; openers of equal priority keep their order. */ private getValidOpeners; /** * All openers for the uri, in the order of their providers. */ private getAllOpenersForUri; private getConfiguredOpenerForUri; private showOpenerPrompt; }