sussudio
Version:
An unofficial VS Code Internal API
135 lines (134 loc) • 9.09 kB
text/typescript
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { CancellationToken } from "../../../base/common/cancellation.mjs";
import { IStringDictionary } from "../../../base/common/collections.mjs";
import { Disposable } from "../../../base/common/lifecycle.mjs";
import { URI } from "../../../base/common/uri.mjs";
import { IDownloadService } from "../../download/common/download.mjs";
import { INativeEnvironmentService } from "../../environment/common/environment.mjs";
import { AbstractExtensionManagementService, AbstractExtensionTask, ExtensionVerificationStatus, IInstallExtensionTask, InstallExtensionTaskOptions, IUninstallExtensionTask, UninstallExtensionTaskOptions } from "../common/abstractExtensionManagementService.mjs";
import { IExtensionGalleryService, IExtensionIdentifier, IExtensionManagementService, IGalleryExtension, IGalleryMetadata, ILocalExtension, InstallOperation, Metadata, InstallOptions, InstallVSIXOptions } from "../common/extensionManagement.mjs";
import { ExtensionKey } from "../common/extensionManagementUtil.mjs";
import { IExtensionsProfileScannerService } from "../common/extensionsProfileScannerService.mjs";
import { IExtensionsScannerService, IScannedExtension } from "../common/extensionsScannerService.mjs";
import { ExtensionsDownloader } from "./extensionDownloader.mjs";
import { ExtensionType, IExtension, IExtensionManifest, TargetPlatform } from "../../extensions/common/extensions.mjs";
import { IFileService } from "../../files/common/files.mjs";
import { IInstantiationService } from "../../instantiation/common/instantiation.mjs";
import { ILogService } from "../../log/common/log.mjs";
import { IProductService } from "../../product/common/productService.mjs";
import { ITelemetryService } from "../../telemetry/common/telemetry.mjs";
import { IUriIdentityService } from "../../uriIdentity/common/uriIdentity.mjs";
import { IUserDataProfilesService } from "../../userDataProfile/common/userDataProfile.mjs";
interface InstallableExtension {
zipPath: string;
key: ExtensionKey;
metadata: Metadata;
}
export declare const INativeServerExtensionManagementService: import("../../instantiation/common/instantiation.mjs").ServiceIdentifier<INativeServerExtensionManagementService>;
export interface INativeServerExtensionManagementService extends IExtensionManagementService {
readonly _serviceBrand: undefined;
markAsUninstalled(...extensions: IExtension[]): Promise<void>;
removeUninstalledExtensions(): Promise<void>;
getAllUserInstalled(): Promise<ILocalExtension[]>;
}
export declare class ExtensionManagementService extends AbstractExtensionManagementService implements INativeServerExtensionManagementService {
private readonly extensionsScannerService;
private readonly extensionsProfileScannerService;
private downloadService;
private readonly fileService;
private readonly uriIdentityService;
private readonly extensionsScanner;
private readonly manifestCache;
private readonly extensionsDownloader;
private readonly installGalleryExtensionsTasks;
constructor(galleryService: IExtensionGalleryService, telemetryService: ITelemetryService, logService: ILogService, environmentService: INativeEnvironmentService, extensionsScannerService: IExtensionsScannerService, extensionsProfileScannerService: IExtensionsProfileScannerService, downloadService: IDownloadService, instantiationService: IInstantiationService, fileService: IFileService, productService: IProductService, uriIdentityService: IUriIdentityService, userDataProfilesService: IUserDataProfilesService);
private _targetPlatformPromise;
getTargetPlatform(): Promise<TargetPlatform>;
zip(extension: ILocalExtension): Promise<URI>;
unzip(zipLocation: URI): Promise<IExtensionIdentifier>;
getManifest(vsix: URI): Promise<IExtensionManifest>;
getInstalled(type?: ExtensionType, profileLocation?: URI): Promise<ILocalExtension[]>;
getAllUserInstalled(): Promise<ILocalExtension[]>;
install(vsix: URI, options?: InstallVSIXOptions): Promise<ILocalExtension>;
installFromLocation(location: URI, profileLocation: URI): Promise<ILocalExtension>;
getMetadata(extension: ILocalExtension): Promise<Metadata | undefined>;
updateMetadata(local: ILocalExtension, metadata: IGalleryMetadata): Promise<ILocalExtension>;
updateExtensionScope(local: ILocalExtension, isMachineScoped: boolean): Promise<ILocalExtension>;
reinstallFromGallery(extension: ILocalExtension): Promise<ILocalExtension>;
markAsUninstalled(...extensions: IExtension[]): Promise<void>;
removeUninstalledExtensions(): Promise<void>;
download(extension: IGalleryExtension, operation: InstallOperation): Promise<URI>;
private downloadVsix;
protected getCurrentExtensionsManifestLocation(): URI;
protected createInstallExtensionTask(manifest: IExtensionManifest, extension: URI | IGalleryExtension, options: InstallExtensionTaskOptions): IInstallExtensionTask;
protected createUninstallExtensionTask(extension: ILocalExtension, options: UninstallExtensionTaskOptions): IUninstallExtensionTask;
private collectFiles;
private onDidChangeExtensionsFromAnotherSource;
private readonly knownDirectories;
private watchForExtensionsNotInstalledBySystem;
private onDidFilesChange;
private addExtensionsToProfile;
}
export declare class ExtensionsScanner extends Disposable {
private readonly beforeRemovingExtension;
private readonly fileService;
private readonly extensionsScannerService;
private readonly logService;
private readonly uninstalledPath;
private readonly uninstalledFileLimiter;
private readonly _onExtract;
readonly onExtract: import("../../../base/common/event.mjs").Event<URI>;
constructor(beforeRemovingExtension: (e: ILocalExtension) => Promise<void>, fileService: IFileService, extensionsScannerService: IExtensionsScannerService, logService: ILogService);
cleanUp(): Promise<void>;
scanExtensions(type: ExtensionType | null, profileLocation: URI | undefined): Promise<ILocalExtension[]>;
scanAllUserExtensions(excludeOutdated: boolean): Promise<ILocalExtension[]>;
scanUserExtensionAtLocation(location: URI): Promise<ILocalExtension | null>;
extractUserExtension(extensionKey: ExtensionKey, zipPath: string, metadata: Metadata, token: CancellationToken): Promise<ILocalExtension>;
updateMetadata(local: ILocalExtension, metadata: Partial<Metadata>): Promise<ILocalExtension>;
getUninstalledExtensions(): Promise<IStringDictionary<boolean>>;
setUninstalled(...extensions: IExtension[]): Promise<void>;
setInstalled(extensionKey: ExtensionKey): Promise<ILocalExtension | null>;
removeExtension(extension: ILocalExtension | IScannedExtension, type: string): Promise<void>;
removeUninstalledExtension(extension: ILocalExtension | IScannedExtension): Promise<void>;
private withUninstalledExtensions;
private extractAtLocation;
private rename;
private scanLocalExtension;
private toLocalExtension;
private removeUninstalledExtensions;
private joinErrors;
}
declare abstract class InstallExtensionTask extends AbstractExtensionTask<{
local: ILocalExtension;
metadata: Metadata;
}> implements IInstallExtensionTask {
readonly identifier: IExtensionIdentifier;
readonly source: URI | IGalleryExtension;
protected readonly options: InstallOptions;
protected readonly extensionsScanner: ExtensionsScanner;
protected readonly logService: ILogService;
protected _verificationStatus: ExtensionVerificationStatus;
get verificationStatus(): ExtensionVerificationStatus;
protected _operation: InstallOperation;
get operation(): InstallOperation;
constructor(identifier: IExtensionIdentifier, source: URI | IGalleryExtension, options: InstallOptions, extensionsScanner: ExtensionsScanner, logService: ILogService);
protected installExtension(installableExtension: InstallableExtension, token: CancellationToken): Promise<ILocalExtension>;
protected unsetUninstalledAndGetLocal(extensionKey: ExtensionKey): Promise<ILocalExtension | null>;
private isUninstalled;
private extract;
}
export declare class InstallGalleryExtensionTask extends InstallExtensionTask {
private readonly manifest;
private readonly gallery;
private readonly extensionsDownloader;
constructor(manifest: IExtensionManifest, gallery: IGalleryExtension, options: InstallOptions, extensionsDownloader: ExtensionsDownloader, extensionsScanner: ExtensionsScanner, logService: ILogService);
protected doRun(token: CancellationToken): Promise<{
local: ILocalExtension;
metadata: Metadata;
}>;
protected validateManifest(zipPath: string): Promise<void>;
}
export {};