/*--------------------------------------------------------------------------------------------- * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ declare module 'vscode' { // https://github.com/microsoft/vscode/issues/115616 @alexr00 export enum PortAutoForwardAction { Notify = 1, OpenBrowser = 2, OpenPreview = 3, Silent = 4, Ignore = 5, OpenBrowserOnce = 6 } export class PortAttributes { /** * The port number associated with this this set of attributes. */ port: number; /** * The action to be taken when this port is detected for auto forwarding. */ autoForwardAction: PortAutoForwardAction; /** * Creates a new PortAttributes object * @param port the port number * @param autoForwardAction the action to take when this port is detected */ constructor(port: number, autoForwardAction: PortAutoForwardAction); } export interface PortAttributesProvider { /** * Provides attributes for the given port. For ports that your extension doesn't know about, simply * return undefined. For example, if `providePortAttributes` is called with ports 3000 but your * extension doesn't know anything about 3000 you should return undefined. */ providePortAttributes(port: number, pid: number | undefined, commandLine: string | undefined, token: CancellationToken): ProviderResult; } export namespace workspace { /** * If your extension listens on ports, consider registering a PortAttributesProvider to provide information * about the ports. For example, a debug extension may know about debug ports in it's debuggee. By providing * this information with a PortAttributesProvider the extension can tell the editor that these ports should be * ignored, since they don't need to be user facing. * * @param portSelector If registerPortAttributesProvider is called after you start your process then you may already * know the range of ports or the pid of your process. All properties of a the portSelector must be true for your * provider to get called. * The `portRange` is start inclusive and end exclusive. * @param provider The PortAttributesProvider */ export function registerPortAttributesProvider(portSelector: { pid?: number; portRange?: [number, number]; commandMatcher?: RegExp }, provider: PortAttributesProvider): Disposable; } }