mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a (#7436)
* Merge from vscode 313ede61cbad8f9dc748907b3384e059ddddb79a * fix strict null checks
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user