Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a (#7436)

* Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a

* fix strict null checks
This commit is contained in:
Anthony Dresser
2019-09-30 23:35:45 -07:00
committed by GitHub
parent 6ab03053a0
commit 084524cd2d
196 changed files with 2927 additions and 2547 deletions

View File

@@ -91,7 +91,7 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
if (phase !== LifecyclePhase.Eventually) {
// instantiate everything synchronously and blocking
for (const ctor of toBeInstantiated) {
instantiationService.createInstance(ctor);
this.safeCreateInstance(instantiationService, ctor); // catch error so that other contributions are still considered
}
} else {
// for the Eventually-phase we instantiate contributions
@@ -102,7 +102,7 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
let instantiateSome = (idle: IdleDeadline) => {
while (i < toBeInstantiated.length) {
const ctor = toBeInstantiated[i++];
instantiationService.createInstance(ctor);
this.safeCreateInstance(instantiationService, ctor); // catch error so that other contributions are still considered
if (idle.timeRemaining() < 1) {
// time is up -> reschedule
runWhenIdle(instantiateSome, forcedTimeout);
@@ -114,6 +114,14 @@ class WorkbenchContributionsRegistry implements IWorkbenchContributionsRegistry
}
}
}
private safeCreateInstance(instantiationService: IInstantiationService, ctor: IConstructorSignature0<IWorkbenchContribution>): void {
try {
instantiationService.createInstance(ctor);
} catch (error) {
console.error(`Unable to instantiate workbench contribution ${ctor}.`, error);
}
}
}
Registry.add(Extensions.Workbench, new WorkbenchContributionsRegistry());