mirror of
https://github.com/Microsoft/vscode
synced 2024-09-12 21:24:38 +00:00
debt: remove scanning added extension and just convert it (#214354)
This commit is contained in:
parent
46488eb08b
commit
88e3cecadc
|
@ -3,7 +3,6 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
|
@ -16,5 +15,4 @@ export interface IRemoteExtensionsScannerService {
|
|||
|
||||
whenExtensionsReady(): Promise<void>;
|
||||
scanExtensions(): Promise<IExtensionDescription[]>;
|
||||
scanSingleExtension(extensionLocation: URI, isBuiltin: boolean): Promise<IExtensionDescription | null>;
|
||||
}
|
||||
|
|
|
@ -103,26 +103,6 @@ export class RemoteExtensionsScannerService implements IRemoteExtensionsScannerS
|
|||
return extensions;
|
||||
}
|
||||
|
||||
async scanSingleExtension(extensionLocation: URI, isBuiltin: boolean, language?: string): Promise<IExtensionDescription | null> {
|
||||
await this._whenBuiltinExtensionsReady;
|
||||
|
||||
const extensionPath = extensionLocation.scheme === Schemas.file ? extensionLocation.fsPath : null;
|
||||
|
||||
if (!extensionPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const extension = await this._scanSingleExtension(extensionPath, isBuiltin, language ?? platform.language);
|
||||
|
||||
if (!extension) {
|
||||
return null;
|
||||
}
|
||||
|
||||
this._massageWhenConditions([extension]);
|
||||
|
||||
return extension;
|
||||
}
|
||||
|
||||
private async _scanExtensions(profileLocation: URI, language: string, workspaceInstalledExtensionLocations: URI[] | undefined, extensionDevelopmentPath: string[] | undefined, languagePackId: string | undefined): Promise<IExtensionDescription[]> {
|
||||
await this._ensureLanguagePackIsInstalled(language, languagePackId);
|
||||
|
||||
|
@ -168,13 +148,6 @@ export class RemoteExtensionsScannerService implements IRemoteExtensionsScannerS
|
|||
return scannedExtensions.map(e => toExtensionDescription(e, false));
|
||||
}
|
||||
|
||||
private async _scanSingleExtension(extensionPath: string, isBuiltin: boolean, language: string): Promise<IExtensionDescription | null> {
|
||||
const extensionLocation = URI.file(resolve(extensionPath));
|
||||
const type = isBuiltin ? ExtensionType.System : ExtensionType.User;
|
||||
const scannedExtension = await this._extensionsScannerService.scanExistingExtension(extensionLocation, type, { language });
|
||||
return scannedExtension ? toExtensionDescription(scannedExtension, false) : null;
|
||||
}
|
||||
|
||||
private async _ensureLanguagePackIsInstalled(language: string, languagePackId: string | undefined): Promise<void> {
|
||||
if (
|
||||
// No need to install language packs for the default language
|
||||
|
@ -351,10 +324,6 @@ export class RemoteExtensionsScannerChannel implements IServerChannel {
|
|||
);
|
||||
return extensions.map(extension => transformOutgoingURIs(extension, uriTransformer));
|
||||
}
|
||||
case 'scanSingleExtension': {
|
||||
const extension = await this.service.scanSingleExtension(URI.revive(uriTransformer.transformIncoming(args[0])), args[1], args[2]);
|
||||
return extension ? transformOutgoingURIs(extension, uriTransformer) : null;
|
||||
}
|
||||
}
|
||||
throw new Error('Invalid call');
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@ import { Schemas } from 'vs/base/common/network';
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ExtensionKind } from 'vs/platform/environment/common/environment';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtension, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -111,19 +111,6 @@ export class ExtensionService extends AbstractExtensionService implements IExten
|
|||
this._initFetchFileSystem();
|
||||
}
|
||||
|
||||
protected async _scanSingleExtension(extension: IExtension): Promise<IExtensionDescription | null> {
|
||||
if (extension.location.scheme === Schemas.vscodeRemote) {
|
||||
return this._remoteExtensionsScannerService.scanSingleExtension(extension.location, extension.type === ExtensionType.System);
|
||||
}
|
||||
|
||||
const scannedExtension = await this._webExtensionsScannerService.scanExistingExtension(extension.location, extension.type, this._userDataProfileService.currentProfile.extensionsResource);
|
||||
if (scannedExtension) {
|
||||
return toExtensionDescription(scannedExtension);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private _initFetchFileSystem(): void {
|
||||
const provider = new FetchFileSystemProvider();
|
||||
this._register(this._fileService.registerProvider(Schemas.http, provider));
|
||||
|
|
|
@ -45,7 +45,7 @@ import { IResolveAuthorityErrorResult } from 'vs/workbench/services/extensions/c
|
|||
import { IExtensionManifestPropertiesService } from 'vs/workbench/services/extensions/common/extensionManifestPropertiesService';
|
||||
import { ExtensionRunningLocation, LocalProcessRunningLocation, LocalWebWorkerRunningLocation, RemoteRunningLocation } from 'vs/workbench/services/extensions/common/extensionRunningLocation';
|
||||
import { ExtensionRunningLocationTracker, filterExtensionIdentifiers } from 'vs/workbench/services/extensions/common/extensionRunningLocationTracker';
|
||||
import { ActivationKind, ActivationTimes, ExtensionActivationReason, ExtensionHostStartup, ExtensionPointContribution, IExtensionHost, IExtensionService, IExtensionsStatus, IInternalExtensionService, IMessage, IResponsiveStateChangeEvent, IWillActivateEvent, WillStopExtensionHostsEvent, toExtension } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ActivationKind, ActivationTimes, ExtensionActivationReason, ExtensionHostStartup, ExtensionPointContribution, IExtensionHost, IExtensionService, IExtensionsStatus, IInternalExtensionService, IMessage, IResponsiveStateChangeEvent, IWillActivateEvent, WillStopExtensionHostsEvent, toExtension, toExtensionDescription } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { ExtensionsProposedApi } from 'vs/workbench/services/extensions/common/extensionsProposedApi';
|
||||
import { ExtensionMessageCollector, ExtensionPoint, ExtensionsRegistry, IExtensionPoint, IExtensionPointUser } from 'vs/workbench/services/extensions/common/extensionsRegistry';
|
||||
import { LazyCreateExtensionHostManager } from 'vs/workbench/services/extensions/common/lazyCreateExtensionHostManager';
|
||||
|
@ -269,7 +269,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
|
|||
for (let i = 0, len = _toAdd.length; i < len; i++) {
|
||||
const extension = _toAdd[i];
|
||||
|
||||
const extensionDescription = await this._scanSingleExtension(extension);
|
||||
const extensionDescription = toExtensionDescription(extension, false);
|
||||
if (!extensionDescription) {
|
||||
// could not scan extension...
|
||||
continue;
|
||||
|
@ -1170,7 +1170,6 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
|
|||
//#endregion
|
||||
|
||||
protected abstract _resolveExtensions(): Promise<ResolvedExtensions>;
|
||||
protected abstract _scanSingleExtension(extension: IExtension): Promise<IExtensionDescription | null>;
|
||||
protected abstract _onExtensionHostExit(code: number): void;
|
||||
protected abstract _resolveAuthority(remoteAuthority: string): Promise<ResolverResult>;
|
||||
}
|
||||
|
|
|
@ -556,16 +556,18 @@ export function toExtension(extensionDescription: IExtensionDescription): IExten
|
|||
}
|
||||
|
||||
export function toExtensionDescription(extension: IExtension, isUnderDevelopment?: boolean): IExtensionDescription {
|
||||
const id = getExtensionId(extension.manifest.publisher, extension.manifest.name);
|
||||
return {
|
||||
identifier: new ExtensionIdentifier(getExtensionId(extension.manifest.publisher, extension.manifest.name)),
|
||||
id,
|
||||
identifier: new ExtensionIdentifier(id),
|
||||
isBuiltin: extension.type === ExtensionType.System,
|
||||
isUserBuiltin: extension.type === ExtensionType.User && extension.isBuiltin,
|
||||
isUnderDevelopment: !!isUnderDevelopment,
|
||||
extensionLocation: extension.location,
|
||||
...extension.manifest,
|
||||
uuid: extension.identifier.uuid,
|
||||
targetPlatform: extension.targetPlatform,
|
||||
publisherDisplayName: extension.publisherDisplayName,
|
||||
...extension.manifest,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -3,10 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as path from 'vs/base/common/path';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IExtensionDescription, ExtensionType, IExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { IExtensionDescription, IExtension } from 'vs/platform/extensions/common/extensions';
|
||||
import { dedupExtensions } from 'vs/workbench/services/extensions/common/extensionsUtil';
|
||||
import { IExtensionsScannerService, IScannedExtension, toExtensionDescription as toExtensionDescriptionFromScannedExtension } from 'vs/platform/extensionManagement/common/extensionsScannerService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
@ -42,11 +40,6 @@ export class CachedExtensionScanner {
|
|||
});
|
||||
}
|
||||
|
||||
public async scanSingleExtension(extensionPath: string, isBuiltin: boolean): Promise<IExtensionDescription | null> {
|
||||
const scannedExtension = await this._extensionsScannerService.scanExistingExtension(URI.file(path.resolve(extensionPath)), isBuiltin ? ExtensionType.System : ExtensionType.User, { language: platform.language });
|
||||
return scannedExtension ? toExtensionDescriptionFromScannedExtension(scannedExtension, false) : null;
|
||||
}
|
||||
|
||||
public async startScanningExtensions(): Promise<void> {
|
||||
try {
|
||||
const extensions = await this._scanInstalledExtensions();
|
||||
|
|
|
@ -19,7 +19,7 @@ import { ConfigurationScope } from 'vs/platform/configuration/common/configurati
|
|||
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { ExtensionKind } from 'vs/platform/environment/common/environment';
|
||||
import { IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
|
||||
import { ExtensionIdentifier, ExtensionType, IExtension, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { InstantiationType, registerSingleton } from 'vs/platform/instantiation/common/extensions';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
@ -141,14 +141,6 @@ export class NativeExtensionService extends AbstractExtensionService implements
|
|||
});
|
||||
}
|
||||
|
||||
protected _scanSingleExtension(extension: IExtension): Promise<IExtensionDescription | null> {
|
||||
if (extension.location.scheme === Schemas.vscodeRemote) {
|
||||
return this._remoteExtensionsScannerService.scanSingleExtension(extension.location, extension.type === ExtensionType.System);
|
||||
}
|
||||
|
||||
return this._extensionScanner.scanSingleExtension(extension.location.fsPath, extension.type === ExtensionType.System);
|
||||
}
|
||||
|
||||
private async _scanAllLocalExtensions(): Promise<IExtensionDescription[]> {
|
||||
return this._extensionScanner.scannedExtensions;
|
||||
}
|
||||
|
|
|
@ -64,25 +64,6 @@ class RemoteExtensionsScannerService implements IRemoteExtensionsScannerService
|
|||
}
|
||||
}
|
||||
|
||||
async scanSingleExtension(extensionLocation: URI, isBuiltin: boolean): Promise<IExtensionDescription | null> {
|
||||
try {
|
||||
return await this.withChannel(
|
||||
async (channel) => {
|
||||
const extension = await channel.call<IRelaxedExtensionDescription>('scanSingleExtension', [extensionLocation, isBuiltin, platform.language]);
|
||||
if (extension !== null) {
|
||||
extension.extensionLocation = URI.revive(extension.extensionLocation);
|
||||
// ImplicitActivationEvents.updateManifest(extension);
|
||||
}
|
||||
return extension;
|
||||
},
|
||||
null
|
||||
);
|
||||
} catch (error) {
|
||||
this.logService.error(error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private withChannel<R>(callback: (channel: IChannel) => Promise<R>, fallback: R): Promise<R> {
|
||||
const connection = this.remoteAgentService.getConnection();
|
||||
if (!connection) {
|
||||
|
|
|
@ -2123,7 +2123,6 @@ export class TestRemoteExtensionsScannerService implements IRemoteExtensionsScan
|
|||
declare readonly _serviceBrand: undefined;
|
||||
async whenExtensionsReady(): Promise<void> { }
|
||||
scanExtensions(): Promise<IExtensionDescription[]> { throw new Error('Method not implemented.'); }
|
||||
scanSingleExtension(): Promise<IExtensionDescription | null> { throw new Error('Method not implemented.'); }
|
||||
}
|
||||
|
||||
export class TestWorkbenchExtensionEnablementService implements IWorkbenchExtensionEnablementService {
|
||||
|
|
Loading…
Reference in a new issue