mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-20 02:08:47 +00:00
remove any type usage (#276894)
* remove any type usage * remove more usages
This commit is contained in:
committed by
GitHub
parent
119d21a125
commit
bee4d296a0
@@ -442,19 +442,6 @@ export default tseslint.config(
|
||||
'src/vs/platform/diagnostics/common/diagnostics.ts',
|
||||
'src/vs/platform/diagnostics/node/diagnosticsService.ts',
|
||||
'src/vs/platform/download/common/downloadIpc.ts',
|
||||
'src/vs/platform/extensionManagement/common/abstractExtensionManagementService.ts',
|
||||
'src/vs/platform/extensionManagement/common/allowedExtensionsService.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionGalleryManifestServiceIpc.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionGalleryService.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionManagement.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionManagementIpc.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionManagementUtil.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionNls.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionStorage.ts',
|
||||
'src/vs/platform/extensionManagement/common/extensionsProfileScannerService.ts',
|
||||
'src/vs/platform/extensionManagement/common/implicitActivationEvents.ts',
|
||||
'src/vs/platform/extensionManagement/node/extensionManagementService.ts',
|
||||
'src/vs/platform/extensionRecommendations/common/extensionRecommendationsIpc.ts',
|
||||
'src/vs/platform/extensions/common/extensionValidator.ts',
|
||||
'src/vs/platform/extensions/common/extensions.ts',
|
||||
'src/vs/platform/instantiation/common/descriptors.ts',
|
||||
|
||||
@@ -277,7 +277,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
|
||||
protected async installExtensions(extensions: InstallableExtension[]): Promise<InstallExtensionResult[]> {
|
||||
const installExtensionResultsMap = new Map<string, InstallExtensionResult & { profileLocation: URI }>();
|
||||
const installingExtensionsMap = new Map<string, { task: IInstallExtensionTask; root: IInstallExtensionTask | undefined; uninstallTaskToWaitFor?: IUninstallExtensionTask }>();
|
||||
const alreadyRequestedInstallations: Promise<any>[] = [];
|
||||
const alreadyRequestedInstallations: Promise<ILocalExtension>[] = [];
|
||||
|
||||
const getInstallExtensionTaskKey = (extension: IGalleryExtension, profileLocation: URI) => `${ExtensionKey.create(extension).toString()}-${profileLocation.toString()}`;
|
||||
const createInstallExtensionTask = (manifest: IExtensionManifest, extension: IGalleryExtension | URI, options: InstallExtensionTaskOptions, root: IInstallExtensionTask | undefined): void => {
|
||||
@@ -303,6 +303,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
|
||||
// Extension failed to install
|
||||
throw new Error(`Extension ${identifier.id} is not installed`);
|
||||
}
|
||||
return result.local;
|
||||
}));
|
||||
}
|
||||
return;
|
||||
@@ -410,7 +411,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
|
||||
reportTelemetry(this.telemetryService, task.operation === InstallOperation.Update ? 'extensionGallery:update' : 'extensionGallery:install', {
|
||||
extensionData: getGalleryExtensionTelemetryData(task.source),
|
||||
error,
|
||||
source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
|
||||
source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT] as string | undefined
|
||||
});
|
||||
}
|
||||
installExtensionResultsMap.set(key, { error, identifier: task.identifier, operation: task.operation, source: task.source, context: task.options.context, profileLocation: task.options.profileLocation, applicationScoped: task.options.isApplicationScoped });
|
||||
@@ -425,7 +426,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
|
||||
verificationStatus: task.verificationStatus,
|
||||
duration: new Date().getTime() - startTime,
|
||||
durationSinceUpdate,
|
||||
source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT]
|
||||
source: task.options.context?.[EXTENSION_INSTALL_SOURCE_CONTEXT] as string | undefined
|
||||
});
|
||||
// In web, report extension install statistics explicitly. In Desktop, statistics are automatically updated while downloading the VSIX.
|
||||
if (isWeb && task.operation !== InstallOperation.Update) {
|
||||
@@ -765,7 +766,7 @@ export abstract class AbstractExtensionManagementService extends CommontExtensio
|
||||
|
||||
const allTasks: { task: IUninstallExtensionTask; installTaskToWaitFor?: IInstallExtensionTask }[] = [];
|
||||
const processedTasks: IUninstallExtensionTask[] = [];
|
||||
const alreadyRequestedUninstalls: Promise<any>[] = [];
|
||||
const alreadyRequestedUninstalls: Promise<void>[] = [];
|
||||
const extensionsToRemove: ILocalExtension[] = [];
|
||||
|
||||
const installedExtensionsMap = new ResourceMap<ILocalExtension[]>();
|
||||
@@ -1003,7 +1004,7 @@ function reportTelemetry(telemetryService: ITelemetryService, eventName: string,
|
||||
source,
|
||||
durationSinceUpdate
|
||||
}: {
|
||||
extensionData: any;
|
||||
extensionData: object;
|
||||
verificationStatus?: ExtensionSignatureVerificationCode;
|
||||
duration?: number;
|
||||
durationSinceUpdate?: number;
|
||||
|
||||
@@ -13,12 +13,12 @@ import { IConfigurationService } from '../../configuration/common/configuration.
|
||||
import { isBoolean, isObject, isUndefined } from '../../../base/common/types.js';
|
||||
import { Emitter } from '../../../base/common/event.js';
|
||||
|
||||
function isGalleryExtension(extension: any): extension is IGalleryExtension {
|
||||
return extension.type === 'gallery';
|
||||
function isGalleryExtension(extension: unknown): extension is IGalleryExtension {
|
||||
return (extension as IGalleryExtension).type === 'gallery';
|
||||
}
|
||||
|
||||
function isIExtension(extension: any): extension is IExtension {
|
||||
return extension.type === ExtensionType.User || extension.type === ExtensionType.System;
|
||||
function isIExtension(extension: unknown): extension is IExtension {
|
||||
return (extension as IExtension).type === ExtensionType.User || (extension as IExtension).type === ExtensionType.System;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { Barrier } from '../../../base/common/async.js';
|
||||
import { Emitter, Event } from '../../../base/common/event.js';
|
||||
import { IPCServer } from '../../../base/parts/ipc/common/ipc.js';
|
||||
import { IChannelServer } from '../../../base/parts/ipc/common/ipc.js';
|
||||
import { IProductService } from '../../product/common/productService.js';
|
||||
import { IExtensionGalleryManifest, IExtensionGalleryManifestService, ExtensionGalleryManifestStatus } from './extensionGalleryManifest.js';
|
||||
import { ExtensionGalleryManifestService } from './extensionGalleryManifestService.js';
|
||||
@@ -28,12 +28,13 @@ export class ExtensionGalleryManifestIPCService extends ExtensionGalleryManifest
|
||||
}
|
||||
|
||||
constructor(
|
||||
server: IPCServer<any>,
|
||||
server: IChannelServer<unknown>,
|
||||
@IProductService productService: IProductService
|
||||
) {
|
||||
super(productService);
|
||||
server.registerChannel('extensionGalleryManifest', {
|
||||
listen: () => Event.None,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
call: async (context: any, command: string, args?: any): Promise<any> => {
|
||||
switch (command) {
|
||||
case 'setExtensionGalleryManifest': return Promise.resolve(this.setExtensionGalleryManifest(args[0]));
|
||||
|
||||
@@ -485,7 +485,7 @@ function setTelemetry(extension: IGalleryExtension, index: number, querySource?:
|
||||
extension.telemetryData = { index, querySource, queryActivityId: extension.queryContext?.[SEARCH_ACTIVITY_HEADER_NAME] };
|
||||
}
|
||||
|
||||
function toExtension(galleryExtension: IRawGalleryExtension, version: IRawGalleryExtensionVersion, allTargetPlatforms: TargetPlatform[], extensionGalleryManifest: IExtensionGalleryManifest, productService: IProductService, queryContext?: IStringDictionary<any>): IGalleryExtension {
|
||||
function toExtension(galleryExtension: IRawGalleryExtension, version: IRawGalleryExtensionVersion, allTargetPlatforms: TargetPlatform[], extensionGalleryManifest: IExtensionGalleryManifest, productService: IProductService, queryContext?: IStringDictionary<unknown>): IGalleryExtension {
|
||||
const latestVersion = galleryExtension.versions[0];
|
||||
const assets: IGalleryExtensionAssets = {
|
||||
manifest: getVersionAsset(version, AssetType.Manifest),
|
||||
@@ -614,7 +614,7 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
|
||||
|
||||
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, token: CancellationToken): Promise<IGalleryExtension[]>;
|
||||
getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, options: IExtensionQueryOptions, token: CancellationToken): Promise<IGalleryExtension[]>;
|
||||
async getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, arg1: any, arg2?: any): Promise<IGalleryExtension[]> {
|
||||
async getExtensions(extensionInfos: ReadonlyArray<IExtensionInfo>, arg1: CancellationToken | IExtensionQueryOptions, arg2?: CancellationToken): Promise<IGalleryExtension[]> {
|
||||
const extensionGalleryManifest = await this.extensionGalleryManifestService.getExtensionGalleryManifest();
|
||||
if (!extensionGalleryManifest) {
|
||||
throw new Error('No extension gallery service configured.');
|
||||
@@ -1570,7 +1570,8 @@ export abstract class AbstractExtensionGalleryService implements IExtensionGalle
|
||||
fallbackUri: `${extension.assets.download.fallbackUri}${URI.parse(extension.assets.download.fallbackUri).query ? '&' : '?'}${operationParam}=true`
|
||||
} : extension.assets.download;
|
||||
|
||||
const headers: IHeaders | undefined = extension.queryContext?.[SEARCH_ACTIVITY_HEADER_NAME] ? { [SEARCH_ACTIVITY_HEADER_NAME]: extension.queryContext[SEARCH_ACTIVITY_HEADER_NAME] } : undefined;
|
||||
const activityId = extension.queryContext?.[SEARCH_ACTIVITY_HEADER_NAME];
|
||||
const headers: IHeaders | undefined = activityId && typeof activityId === 'string' ? { [SEARCH_ACTIVITY_HEADER_NAME]: activityId } : undefined;
|
||||
const context = await this.getAsset(extension.identifier.id, downloadAsset, AssetType.VSIX, extension.version, headers ? { headers } : undefined);
|
||||
|
||||
try {
|
||||
|
||||
@@ -190,8 +190,9 @@ export interface IGalleryExtensionAssets {
|
||||
coreTranslations: [string, IGalleryExtensionAsset][];
|
||||
}
|
||||
|
||||
export function isIExtensionIdentifier(thing: any): thing is IExtensionIdentifier {
|
||||
return thing
|
||||
export function isIExtensionIdentifier(obj: unknown): obj is IExtensionIdentifier {
|
||||
const thing = obj as IExtensionIdentifier | undefined;
|
||||
return !!thing
|
||||
&& typeof thing === 'object'
|
||||
&& typeof thing.id === 'string'
|
||||
&& (!thing.uuid || typeof thing.uuid === 'string');
|
||||
@@ -244,8 +245,8 @@ export interface IGalleryExtension {
|
||||
detailsLink?: string;
|
||||
ratingLink?: string;
|
||||
supportLink?: string;
|
||||
telemetryData?: any;
|
||||
queryContext?: IStringDictionary<any>;
|
||||
telemetryData?: IStringDictionary<unknown>;
|
||||
queryContext?: IStringDictionary<unknown>;
|
||||
}
|
||||
|
||||
export type InstallSource = 'gallery' | 'vsix' | 'resource';
|
||||
@@ -435,7 +436,7 @@ export interface InstallExtensionResult {
|
||||
readonly source?: URI | IGalleryExtension;
|
||||
readonly local?: ILocalExtension;
|
||||
readonly error?: Error;
|
||||
readonly context?: IStringDictionary<any>;
|
||||
readonly context?: IStringDictionary<unknown>;
|
||||
readonly profileLocation: URI;
|
||||
readonly applicationScoped?: boolean;
|
||||
readonly workspaceScoped?: boolean;
|
||||
@@ -578,7 +579,7 @@ export type InstallOptions = {
|
||||
/**
|
||||
* Context passed through to InstallExtensionResult
|
||||
*/
|
||||
context?: IStringDictionary<any>;
|
||||
context?: IStringDictionary<unknown>;
|
||||
};
|
||||
|
||||
export type UninstallOptions = {
|
||||
|
||||
@@ -18,6 +18,7 @@ import { ExtensionType, IExtensionManifest, TargetPlatform } from '../../extensi
|
||||
import { IProductService } from '../../product/common/productService.js';
|
||||
import { CommontExtensionManagementService } from './abstractExtensionManagementService.js';
|
||||
import { language } from '../../../base/common/platform.js';
|
||||
import { RemoteAgentConnectionContext } from '../../remote/common/remoteAgentEnvironment.js';
|
||||
|
||||
function transformIncomingURI(uri: UriComponents, transformer: IURITransformer | null): URI;
|
||||
function transformIncomingURI(uri: UriComponents | undefined, transformer: IURITransformer | null): URI | undefined;
|
||||
@@ -44,7 +45,7 @@ function transformOutgoingExtension(extension: ILocalExtension, transformer: IUR
|
||||
return transformer ? cloneAndChange(extension, value => value instanceof URI ? transformer.transformOutgoingURI(value) : undefined) : extension;
|
||||
}
|
||||
|
||||
export class ExtensionManagementChannel implements IServerChannel {
|
||||
export class ExtensionManagementChannel<TContext = RemoteAgentConnectionContext | string> implements IServerChannel<TContext> {
|
||||
|
||||
readonly onInstallExtension: Event<InstallExtensionEvent>;
|
||||
readonly onDidInstallExtensions: Event<readonly InstallExtensionResult[]>;
|
||||
@@ -52,7 +53,7 @@ export class ExtensionManagementChannel implements IServerChannel {
|
||||
readonly onDidUninstallExtension: Event<DidUninstallExtensionEvent>;
|
||||
readonly onDidUpdateExtensionMetadata: Event<DidUpdateExtensionMetadata>;
|
||||
|
||||
constructor(private service: IExtensionManagementService, private getUriTransformer: (requestContext: any) => IURITransformer | null) {
|
||||
constructor(private service: IExtensionManagementService, private getUriTransformer: (requestContext: TContext) => IURITransformer | null) {
|
||||
this.onInstallExtension = Event.buffer(service.onInstallExtension, true);
|
||||
this.onDidInstallExtensions = Event.buffer(service.onDidInstallExtensions, true);
|
||||
this.onUninstallExtension = Event.buffer(service.onUninstallExtension, true);
|
||||
@@ -60,6 +61,7 @@ export class ExtensionManagementChannel implements IServerChannel {
|
||||
this.onDidUpdateExtensionMetadata = Event.buffer(service.onDidUpdateExtensionMetadata, true);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
listen(context: any, event: string): Event<any> {
|
||||
const uriTransformer = this.getUriTransformer(context);
|
||||
switch (event) {
|
||||
@@ -108,6 +110,7 @@ export class ExtensionManagementChannel implements IServerChannel {
|
||||
throw new Error('Invalid listen');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async call(context: any, command: string, args?: any): Promise<any> {
|
||||
const uriTransformer: IURITransformer | null = this.getUriTransformer(context);
|
||||
switch (command) {
|
||||
@@ -236,14 +239,13 @@ export class ExtensionManagementChannelClient extends CommontExtensionManagement
|
||||
this._onDidUpdateExtensionMetadata.fire(event);
|
||||
}
|
||||
|
||||
private isUriComponents(thing: unknown): thing is UriComponents {
|
||||
if (!thing) {
|
||||
private isUriComponents(obj: unknown): obj is UriComponents {
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
return typeof (<any>thing).path === 'string' &&
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
typeof (<any>thing).scheme === 'string';
|
||||
const thing = obj as UriComponents | undefined;
|
||||
return typeof thing?.path === 'string' &&
|
||||
typeof thing?.scheme === 'string';
|
||||
}
|
||||
|
||||
protected _targetPlatformPromise: Promise<TargetPlatform> | undefined;
|
||||
@@ -343,10 +345,12 @@ export class ExtensionTipsChannel implements IServerChannel {
|
||||
constructor(private service: IExtensionTipsService) {
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
listen(context: any, event: string): Event<any> {
|
||||
throw new Error('Invalid listen');
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
call(context: any, command: string, args?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'getConfigBasedTips': return this.service.getConfigBasedTips(URI.revive(args[0]));
|
||||
|
||||
@@ -54,7 +54,7 @@ export class ExtensionKey {
|
||||
return `${this.id}-${this.version}${this.targetPlatform !== TargetPlatform.UNDEFINED ? `-${this.targetPlatform}` : ''}`;
|
||||
}
|
||||
|
||||
equals(o: any): boolean {
|
||||
equals(o: unknown): boolean {
|
||||
if (!(o instanceof ExtensionKey)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ export function localizeManifest(logger: ILogger, extensionManifest: IExtensionM
|
||||
* The root element is an object literal
|
||||
*/
|
||||
function replaceNLStrings(logger: ILogger, extensionManifest: IExtensionManifest, messages: ITranslations, originalMessages?: ITranslations): void {
|
||||
const processEntry = (obj: any, key: string | number, command?: boolean) => {
|
||||
const processEntry = (obj: Record<string, unknown>, key: string | number, command?: boolean) => {
|
||||
const value = obj[key];
|
||||
if (isString(value)) {
|
||||
const str = value;
|
||||
@@ -72,11 +72,11 @@ function replaceNLStrings(logger: ILogger, extensionManifest: IExtensionManifest
|
||||
} else if (isObject(value)) {
|
||||
for (const k in value) {
|
||||
if (value.hasOwnProperty(k)) {
|
||||
k === 'commands' ? processEntry(value, k, true) : processEntry(value, k, command);
|
||||
k === 'commands' ? processEntry(value as Record<string, unknown>, k, true) : processEntry(value as Record<string, unknown>, k, command);
|
||||
}
|
||||
}
|
||||
} else if (Array.isArray(value)) {
|
||||
for (let i = 0; i < value.length; i++) {
|
||||
for (let i = 0; i < (value as Array<unknown>).length; i++) {
|
||||
processEntry(value, i, command);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ export const IExtensionStorageService = createDecorator<IExtensionStorageService
|
||||
export interface IExtensionStorageService {
|
||||
readonly _serviceBrand: undefined;
|
||||
|
||||
getExtensionState(extension: IExtension | IGalleryExtension | string, global: boolean): IStringDictionary<any> | undefined;
|
||||
getExtensionState(extension: IExtension | IGalleryExtension | string, global: boolean): IStringDictionary<unknown> | undefined;
|
||||
getExtensionStateRaw(extension: IExtension | IGalleryExtension | string, global: boolean): string | undefined;
|
||||
setExtensionState(extension: IExtension | IGalleryExtension | string, state: IStringDictionary<any> | undefined, global: boolean): void;
|
||||
setExtensionState(extension: IExtension | IGalleryExtension | string, state: object | undefined, global: boolean): void;
|
||||
|
||||
readonly onDidChangeExtensionStorageToSync: Event<void>;
|
||||
setKeysForSync(extensionIdWithVersion: IExtensionIdWithVersion, keys: string[]): void;
|
||||
@@ -140,7 +140,7 @@ export class ExtensionStorageService extends Disposable implements IExtensionSto
|
||||
return getExtensionId(publisher, name);
|
||||
}
|
||||
|
||||
getExtensionState(extension: IExtension | IGalleryExtension | string, global: boolean): IStringDictionary<any> | undefined {
|
||||
getExtensionState(extension: IExtension | IGalleryExtension | string, global: boolean): IStringDictionary<unknown> | undefined {
|
||||
const extensionId = this.getExtensionId(extension);
|
||||
const jsonValue = this.getExtensionStateRaw(extension, global);
|
||||
if (jsonValue) {
|
||||
@@ -167,7 +167,7 @@ export class ExtensionStorageService extends Disposable implements IExtensionSto
|
||||
return rawState;
|
||||
}
|
||||
|
||||
setExtensionState(extension: IExtension | IGalleryExtension | string, state: IStringDictionary<any> | undefined, global: boolean): void {
|
||||
setExtensionState(extension: IExtension | IGalleryExtension | string, state: IStringDictionary<unknown> | undefined, global: boolean): void {
|
||||
const extensionId = this.getExtensionId(extension);
|
||||
if (state === undefined) {
|
||||
this.storageService.remove(extensionId, global ? StorageScope.PROFILE : StorageScope.WORKSPACE);
|
||||
|
||||
@@ -390,20 +390,21 @@ export abstract class AbstractExtensionsProfileScannerService extends Disposable
|
||||
}
|
||||
}
|
||||
|
||||
function isStoredProfileExtension(candidate: any): candidate is IStoredProfileExtension {
|
||||
function isStoredProfileExtension(obj: unknown): obj is IStoredProfileExtension {
|
||||
const candidate = obj as IStoredProfileExtension | undefined;
|
||||
return isObject(candidate)
|
||||
&& isIExtensionIdentifier(candidate.identifier)
|
||||
&& (isUriComponents(candidate.location) || (isString(candidate.location) && candidate.location))
|
||||
&& (isUriComponents(candidate.location) || (isString(candidate.location) && !!candidate.location))
|
||||
&& (isUndefined(candidate.relativeLocation) || isString(candidate.relativeLocation))
|
||||
&& candidate.version && isString(candidate.version);
|
||||
&& !!candidate.version
|
||||
&& isString(candidate.version);
|
||||
}
|
||||
|
||||
function isUriComponents(thing: unknown): thing is UriComponents {
|
||||
if (!thing) {
|
||||
function isUriComponents(obj: unknown): obj is UriComponents {
|
||||
if (!obj) {
|
||||
return false;
|
||||
}
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
return isString((<any>thing).path) &&
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
isString((<any>thing).scheme);
|
||||
const thing = obj as UriComponents | undefined;
|
||||
return typeof thing?.path === 'string' &&
|
||||
typeof thing?.scheme === 'string';
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { IStringDictionary } from '../../../base/common/collections.js';
|
||||
import { onUnexpectedError } from '../../../base/common/errors.js';
|
||||
import { ExtensionIdentifier, IExtensionDescription } from '../../extensions/common/extensions.js';
|
||||
|
||||
@@ -12,11 +13,11 @@ export interface IActivationEventsGenerator<T> {
|
||||
|
||||
export class ImplicitActivationEventsImpl {
|
||||
|
||||
private readonly _generators = new Map<string, IActivationEventsGenerator<any>>();
|
||||
private readonly _generators = new Map<string, IActivationEventsGenerator<unknown>>();
|
||||
private readonly _cache = new WeakMap<IExtensionDescription, string[]>();
|
||||
|
||||
public register<T>(extensionPointName: string, generator: IActivationEventsGenerator<T>): void {
|
||||
this._generators.set(extensionPointName, generator);
|
||||
this._generators.set(extensionPointName, generator as IActivationEventsGenerator<unknown>);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,8 +71,7 @@ export class ImplicitActivationEventsImpl {
|
||||
// There's no generator for this extension point
|
||||
continue;
|
||||
}
|
||||
// eslint-disable-next-line local/code-no-any-casts
|
||||
const contrib = (desc.contributes as any)[extPointName];
|
||||
const contrib = (desc.contributes as IStringDictionary<unknown>)[extPointName];
|
||||
const contribArr = Array.isArray(contrib) ? contrib : [contrib];
|
||||
try {
|
||||
activationEvents.push(...generator(contribArr));
|
||||
|
||||
@@ -297,7 +297,7 @@ export class ExtensionManagementService extends AbstractExtensionManagementServi
|
||||
}
|
||||
|
||||
private async downloadAndExtractGalleryExtension(extensionKey: ExtensionKey, gallery: IGalleryExtension, operation: InstallOperation, options: InstallExtensionTaskOptions, token: CancellationToken): Promise<ExtractExtensionResult> {
|
||||
const { verificationStatus, location } = await this.downloadExtension(gallery, operation, !options.donotVerifySignature, options.context?.[EXTENSION_INSTALL_CLIENT_TARGET_PLATFORM_CONTEXT]);
|
||||
const { verificationStatus, location } = await this.downloadExtension(gallery, operation, !options.donotVerifySignature, options.context?.[EXTENSION_INSTALL_CLIENT_TARGET_PLATFORM_CONTEXT] as TargetPlatform | undefined);
|
||||
try {
|
||||
|
||||
if (token.isCancellationRequested) {
|
||||
@@ -534,7 +534,7 @@ type UpdateMetadataErrorEvent = {
|
||||
export class ExtensionsScanner extends Disposable {
|
||||
|
||||
private readonly obsoletedResource: URI;
|
||||
private readonly obsoleteFileLimiter: Queue<any>;
|
||||
private readonly obsoleteFileLimiter: Queue<IStringDictionary<boolean>>;
|
||||
|
||||
private readonly _onExtract = this._register(new Emitter<URI>());
|
||||
readonly onExtract = this._onExtract.event;
|
||||
|
||||
@@ -15,6 +15,7 @@ import { ConfigurationTarget } from '../../../configuration/common/configuration
|
||||
import { getGalleryExtensionId } from '../../common/extensionManagementUtil.js';
|
||||
import { generateUuid } from '../../../../base/common/uuid.js';
|
||||
import { URI } from '../../../../base/common/uri.js';
|
||||
import { IStringDictionary } from '../../../../base/common/collections.js';
|
||||
|
||||
suite('AllowedExtensionsService', () => {
|
||||
|
||||
@@ -208,14 +209,14 @@ suite('AllowedExtensionsService', () => {
|
||||
} as IProductService;
|
||||
}
|
||||
|
||||
function aGalleryExtension(name: string, properties: any = {}, galleryExtensionProperties: any = {}): IGalleryExtension {
|
||||
function aGalleryExtension(name: string, properties: Partial<IGalleryExtension> = {}, galleryExtensionProperties: IStringDictionary<unknown> = {}): IGalleryExtension {
|
||||
const galleryExtension = <IGalleryExtension>Object.create({ type: 'gallery', name, publisher: 'pub', publisherDisplayName: 'Pub', version: '1.0.0', allTargetPlatforms: [TargetPlatform.UNIVERSAL], properties: {}, assets: {}, isSigned: true, ...properties });
|
||||
galleryExtension.properties = { ...galleryExtension.properties, dependencies: [], ...galleryExtensionProperties };
|
||||
galleryExtension.identifier = { id: getGalleryExtensionId(galleryExtension.publisher, galleryExtension.name), uuid: generateUuid() };
|
||||
return <IGalleryExtension>galleryExtension;
|
||||
}
|
||||
|
||||
function aLocalExtension(id: string, manifest: Partial<IExtensionManifest> = {}, properties: any = {}): ILocalExtension {
|
||||
function aLocalExtension(id: string, manifest: Partial<IExtensionManifest> = {}, properties: IStringDictionary<unknown> = {}): ILocalExtension {
|
||||
const [publisher, name] = id.split('.');
|
||||
manifest = { name, publisher, ...manifest };
|
||||
properties = {
|
||||
|
||||
@@ -24,6 +24,7 @@ import { TestInstantiationService } from '../../../instantiation/test/common/ins
|
||||
import { ILogService, NullLogService } from '../../../log/common/log.js';
|
||||
import { IUriIdentityService } from '../../../uriIdentity/common/uriIdentity.js';
|
||||
import { UriIdentityService } from '../../../uriIdentity/common/uriIdentityService.js';
|
||||
import { IStringDictionary } from '../../../../base/common/collections.js';
|
||||
|
||||
const ROOT = URI.file('tests').with({ scheme: 'vscode-tests' });
|
||||
|
||||
@@ -144,7 +145,7 @@ suite('ExtensionDownloader Tests', () => {
|
||||
return disposables.add(instantiationService.createInstance(TestExtensionDownloader));
|
||||
}
|
||||
|
||||
function aGalleryExtension(name: string, properties: Partial<IGalleryExtension> = {}, galleryExtensionProperties: any = {}, assets: Partial<IGalleryExtensionAssets> = {}): IGalleryExtension {
|
||||
function aGalleryExtension(name: string, properties: Partial<IGalleryExtension> = {}, galleryExtensionProperties: IStringDictionary<unknown> = {}, assets: Partial<IGalleryExtensionAssets> = {}): IGalleryExtension {
|
||||
const targetPlatform = getTargetPlatform(platform, arch);
|
||||
const galleryExtension = <IGalleryExtension>Object.create({ name, publisher: 'pub', version: '1.0.0', allTargetPlatforms: [targetPlatform], properties: {}, assets: {}, ...properties });
|
||||
galleryExtension.properties = { ...galleryExtension.properties, dependencies: [], targetPlatform, ...galleryExtensionProperties };
|
||||
|
||||
@@ -33,10 +33,12 @@ export class ExtensionRecommendationNotificationServiceChannel implements IServe
|
||||
|
||||
constructor(private service: IExtensionRecommendationNotificationService) { }
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
listen(_: unknown, event: string): Event<any> {
|
||||
throw new Error(`Event not found: ${event}`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
call(_: unknown, command: string, args?: any): Promise<any> {
|
||||
switch (command) {
|
||||
case 'promptImportantExtensionsInstallNotification': return this.service.promptImportantExtensionsInstallNotification(args[0]);
|
||||
|
||||
Reference in New Issue
Block a user