sussudio
Version:
An unofficial VS Code Internal API
54 lines (53 loc) • 2.56 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 { SyncDescriptor0 } from "./descriptors.mjs";
import { Graph } from "./graph.mjs";
import { GetLeadingNonServiceArgs, IInstantiationService, ServiceIdentifier, ServicesAccessor } from "./instantiation.mjs";
import { ServiceCollection } from "./serviceCollection.mjs";
export declare class InstantiationService implements IInstantiationService {
private readonly _services;
private readonly _strict;
private readonly _parent?;
private readonly _enableTracing;
readonly _serviceBrand: undefined;
readonly _globalGraph?: Graph<string>;
private _globalGraphImplicitDependency?;
constructor(_services?: ServiceCollection, _strict?: boolean, _parent?: InstantiationService | undefined, _enableTracing?: boolean);
createChild(services: ServiceCollection): IInstantiationService;
invokeFunction<R, TS extends any[] = []>(fn: (accessor: ServicesAccessor, ...args: TS) => R, ...args: TS): R;
createInstance<T>(descriptor: SyncDescriptor0<T>): T;
createInstance<Ctor extends new (...args: any[]) => any, R extends InstanceType<Ctor>>(ctor: Ctor, ...args: GetLeadingNonServiceArgs<ConstructorParameters<Ctor>>): R;
private _createInstance;
private _setServiceInstance;
private _getServiceInstanceOrDescriptor;
protected _getOrCreateServiceInstance<T>(id: ServiceIdentifier<T>, _trace: Trace): T;
private readonly _activeInstantiations;
private _safeCreateAndCacheServiceInstance;
private _createAndCacheServiceInstance;
private _createServiceInstanceWithOwner;
private _createServiceInstance;
private _throwIfStrict;
}
declare const enum TraceType {
None = 0,
Creation = 1,
Invocation = 2,
Branch = 3
}
export declare class Trace {
readonly type: TraceType;
readonly name: string | null;
static all: Set<string>;
private static readonly _None;
static traceInvocation(_enableTracing: boolean, ctor: any): Trace;
static traceCreation(_enableTracing: boolean, ctor: any): Trace;
private static _totals;
private readonly _start;
private readonly _dep;
private constructor();
branch(id: ServiceIdentifier<any>, first: boolean): Trace;
stop(): void;
}
export {};