提交 96324f4c 编写于 作者: J Jonatan Ivanov

Merge branch 'master' into jenkinsfile-extension-support

......@@ -11,11 +11,6 @@
"categories": [
"Other"
],
"extensionKind": [
"ui",
"workspace",
"web"
],
"activationEvents": [
"*",
"onAuthenticationRequest:github"
......
......@@ -249,7 +249,7 @@ export class MainThreadAuthentication extends Disposable implements MainThreadAu
}
$ensureProvider(id: string): Promise<void> {
return this.extensionService.activateByEvent(getAuthenticationProviderActivationEvent(id), true);
return this.extensionService.activateByEvent(getAuthenticationProviderActivationEvent(id));
}
$sendDidChangeSessions(id: string, event: modes.AuthenticationSessionsChangeEvent): void {
......
......@@ -1074,7 +1074,7 @@ export type IResolveAuthorityResult = IResolveAuthorityErrorResult | IResolveAut
export interface ExtHostExtensionServiceShape {
$resolveAuthority(remoteAuthority: string, resolveAttempt: number): Promise<IResolveAuthorityResult>;
$startExtensionHost(enabledExtensionIds: ExtensionIdentifier[]): Promise<void>;
$activateByEvent(activationEvent: string, eager?: boolean): Promise<void>;
$activateByEvent(activationEvent: string): Promise<void>;
$activate(extensionId: ExtensionIdentifier, reason: ExtensionActivationReason): Promise<boolean>;
$setRemoteEnvironment(env: { [key: string]: string | null; }): Promise<void>;
$updateRemoteConnectionData(connectionData: IRemoteConnectionData): Promise<void>;
......
......@@ -686,11 +686,7 @@ export abstract class AbstractExtHostExtensionService extends Disposable impleme
return this._startExtensionHost();
}
public $activateByEvent(activationEvent: string, eager: boolean = true): Promise<void> {
if (eager) {
return this._activateByEvent(activationEvent, false);
}
public $activateByEvent(activationEvent: string): Promise<void> {
return (
this._readyToRunExtensions.wait()
.then(_ => this._activateByEvent(activationEvent, false))
......
......@@ -186,7 +186,7 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
this._startExtensionHosts(false, Array.from(this._allRequestedActivateEvents.keys()));
}
public activateByEvent(activationEvent: string, eager?: boolean): Promise<void> {
public activateByEvent(activationEvent: string): Promise<void> {
if (this._installedExtensionsReady.isOpen()) {
// Extensions have been scanned and interpreted
......@@ -205,17 +205,13 @@ export abstract class AbstractExtensionService extends Disposable implements IEx
// Record the fact that this activationEvent was requested (in case of a restart)
this._allRequestedActivateEvents.add(activationEvent);
if (eager) {
return this._activateByEvent(activationEvent, eager);
}
return this._installedExtensionsReady.wait().then(() => this._activateByEvent(activationEvent));
}
}
private _activateByEvent(activationEvent: string, eager?: boolean): Promise<void> {
private _activateByEvent(activationEvent: string): Promise<void> {
const result = Promise.all(
this._extensionHostManagers.map(extHostManager => extHostManager.activateByEvent(activationEvent, eager))
this._extensionHostManagers.map(extHostManager => extHostManager.activateByEvent(activationEvent))
).then(() => { });
this._onWillActivateByEvent.fire({
event: activationEvent,
......
......@@ -48,7 +48,6 @@ export class ExtensionHostManager extends Disposable {
*/
private _proxy: Promise<{ value: ExtHostExtensionServiceShape; } | null> | null;
private _resolveAuthorityAttempt: number;
private _hasStarted = false;
constructor(
extensionHost: IExtensionHost,
......@@ -66,7 +65,6 @@ export class ExtensionHostManager extends Disposable {
this.onDidExit = this._extensionHost.onExit;
this._proxy = this._extensionHost.start()!.then(
(protocol) => {
this._hasStarted = true;
return { value: this._createExtensionHostCustomers(protocol) };
},
(err) => {
......@@ -219,18 +217,14 @@ export class ExtensionHostManager extends Disposable {
return proxy.$activate(extension, reason);
}
public activateByEvent(activationEvent: string, eager?: boolean): Promise<void> {
if (eager && !this._hasStarted) {
return Promise.resolve();
}
public activateByEvent(activationEvent: string): Promise<void> {
if (!this._cachedActivationEvents.has(activationEvent)) {
this._cachedActivationEvents.set(activationEvent, this._activateByEvent(activationEvent, eager));
this._cachedActivationEvents.set(activationEvent, this._activateByEvent(activationEvent));
}
return this._cachedActivationEvents.get(activationEvent)!;
}
private async _activateByEvent(activationEvent: string, eager?: boolean): Promise<void> {
private async _activateByEvent(activationEvent: string): Promise<void> {
if (!this._proxy) {
return;
}
......@@ -240,7 +234,7 @@ export class ExtensionHostManager extends Disposable {
// i.e. the extension host could not be started
return;
}
return proxy.value.$activateByEvent(activationEvent, eager);
return proxy.value.$activateByEvent(activationEvent);
}
public async getInspectPort(tryEnableInspector: boolean): Promise<number> {
......
......@@ -177,13 +177,8 @@ export interface IExtensionService {
/**
* Send an activation event and activate interested extensions.
*
* Normally, this will queue the activation event if the extension hosts are not ready
* and send it to all of them. If the extension needs to be activated before this,
* the eager flag can be used to ignore extension hosts that aren't yet started. Do not
* use this flag unless necessary.
*/
activateByEvent(activationEvent: string, eager?: boolean): Promise<void>;
activateByEvent(activationEvent: string): Promise<void>;
/**
* An promise that resolves when the installed extensions are registered after
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册