Skip to content

Commit 9e18376

Browse files
authored
make service instantiation lazy (microsoft#159680)
* microsoft#159178 make service instantiation lazy * add comment * update comment * make comment clear about cyclic dep * :lisptick:
1 parent e77342e commit 9e18376

31 files changed

+65
-65
lines changed

src/vs/platform/extensionManagement/electron-sandbox/extensionsScannerService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ export class ExtensionsScannerService extends NativeExtensionsScannerService imp
3535

3636
}
3737

38-
registerSingleton(IExtensionsScannerService, ExtensionsScannerService, false);
38+
registerSingleton(IExtensionsScannerService, ExtensionsScannerService, true);

src/vs/workbench/api/common/extHost.common.services.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ import { ExtHostLogService } from 'vs/workbench/api/common/extHostLogService';
2929
import { ExtHostVariableResolverProviderService, IExtHostVariableResolverProvider } from 'vs/workbench/api/common/extHostVariableResolverService';
3030
import { ExtHostTelemetryLogService, IExtHostTelemetryLogService } from 'vs/workbench/api/common/extHostTelemetryLogService';
3131

32-
registerSingleton(ILoggerService, ExtHostLoggerService, false);
33-
registerSingleton(ILogService, ExtHostLogService, false);
32+
registerSingleton(ILoggerService, ExtHostLoggerService, true);
33+
registerSingleton(ILogService, ExtHostLogService, true);
3434
registerSingleton(IExtHostApiDeprecationService, ExtHostApiDeprecationService, false);
3535
registerSingleton(IExtHostCommands, ExtHostCommands, false);
3636
registerSingleton(IExtHostConfiguration, ExtHostConfiguration, false);
@@ -39,7 +39,7 @@ registerSingleton(IExtHostDebugService, WorkerExtHostDebugService, false);
3939
registerSingleton(IExtHostDecorations, ExtHostDecorations, false);
4040
registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors, false);
4141
registerSingleton(IExtHostFileSystemInfo, ExtHostFileSystemInfo, false);
42-
registerSingleton(IExtHostOutputService, ExtHostOutputService, false);
42+
registerSingleton(IExtHostOutputService, ExtHostOutputService, true);
4343
registerSingleton(IExtHostSearch, ExtHostSearch, false);
4444
registerSingleton(IExtHostStorage, ExtHostStorage, false);
4545
registerSingleton(IExtHostTask, WorkerExtHostTask, false);

src/vs/workbench/api/node/extHost.node.services.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ import { IExtHostVariableResolverProvider } from 'vs/workbench/api/common/extHos
3030
// #########################################################################
3131

3232
registerSingleton(IExtHostExtensionService, ExtHostExtensionService, false);
33-
registerSingleton(ILoggerService, ExtHostLoggerService, false);
33+
registerSingleton(ILoggerService, ExtHostLoggerService, true);
3434
registerSingleton(IExtensionStoragePaths, ExtensionStoragePaths, false);
3535

3636
registerSingleton(IExtHostDebugService, ExtHostDebugService, false);

src/vs/workbench/browser/parts/views/viewsService.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,4 +648,5 @@ export function getPartByLocation(viewContainerLocation: ViewContainerLocation):
648648
}
649649
}
650650

651-
registerSingleton(IViewsService, ViewsService, false);
651+
registerSingleton(IViewsService, ViewsService, false /* Eager because of the cyclic dependency when registering PaneComposites (Panel that is active) in its constructor:
652+
ViewsService is registering a panel that is active -> PaneCompositeParts -> PanelPart (CompositePart) is opening the registered panel that is active -> CompositeProgressIndicator -> ViewsService */);

src/vs/workbench/contrib/extensions/browser/extensions.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ import { IStringDictionary } from 'vs/base/common/collections';
8181

8282
// Singletons
8383
registerSingleton(IExtensionsWorkbenchService, ExtensionsWorkbenchService, false);
84-
registerSingleton(IExtensionRecommendationNotificationService, ExtensionRecommendationNotificationService, false);
84+
registerSingleton(IExtensionRecommendationNotificationService, ExtensionRecommendationNotificationService, true);
8585
registerSingleton(IExtensionRecommendationsService, ExtensionRecommendationsService, false);
8686

8787
Registry.as<IOutputChannelRegistry>(OutputExtensions.OutputChannels)

src/vs/workbench/contrib/output/browser/output.contribution.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { CATEGORIES } from 'vs/workbench/common/actions';
3434
import { EditorExtensions } from 'vs/workbench/common/editor';
3535

3636
// Register Service
37-
registerSingleton(IOutputService, OutputService, false);
37+
registerSingleton(IOutputService, OutputService, true);
3838

3939
// Register Output Mode
4040
ModesRegistry.registerLanguage({

src/vs/workbench/contrib/output/common/outputChannelModelService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,4 @@ export class OutputChannelModelService extends AbstractOutputChannelModelService
5757
}
5858
}
5959

60-
registerSingleton(IOutputChannelModelService, OutputChannelModelService, false);
60+
registerSingleton(IOutputChannelModelService, OutputChannelModelService, true);

src/vs/workbench/contrib/output/electron-sandbox/outputChannelModelService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ export class OutputChannelModelService extends AbstractOutputChannelModelService
2626

2727
}
2828

29-
registerSingleton(IOutputChannelModelService, OutputChannelModelService, false);
29+
registerSingleton(IOutputChannelModelService, OutputChannelModelService, true);

src/vs/workbench/services/extensionManagement/browser/builtinExtensionsScannerService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ export class BuiltinExtensionsScannerService implements IBuiltinExtensionsScanne
113113
}
114114
}
115115

116-
registerSingleton(IBuiltinExtensionsScannerService, BuiltinExtensionsScannerService, false);
116+
registerSingleton(IBuiltinExtensionsScannerService, BuiltinExtensionsScannerService, true);

src/vs/workbench/services/extensionManagement/browser/extensionEnablementService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -711,4 +711,4 @@ class ExtensionsManager extends Disposable {
711711
}
712712
}
713713

714-
registerSingleton(IWorkbenchExtensionEnablementService, ExtensionEnablementService, false);
714+
registerSingleton(IWorkbenchExtensionEnablementService, ExtensionEnablementService, true);

0 commit comments

Comments
 (0)