Skip to content

Commit b177848

Browse files
authored
Merge pull request microsoft#159314 from microsoft/joh/registerSingleton-explicit
When calling `registerSingleton` you must signal if you support delayed instantiation
2 parents 57ac833 + e18726f commit b177848

File tree

91 files changed

+179
-181
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

91 files changed

+179
-181
lines changed

src/vs/editor/common/languages/languageConfigurationRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,4 +474,4 @@ export class ResolvedLanguageConfiguration {
474474
}
475475
}
476476

477-
registerSingleton(ILanguageConfigurationService, LanguageConfigurationService);
477+
registerSingleton(ILanguageConfigurationService, LanguageConfigurationService, false);

src/vs/editor/contrib/codelens/browser/codeLensCache.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,4 +129,4 @@ export class CodeLensCache implements ICodeLensCache {
129129
}
130130
}
131131

132-
registerSingleton(ICodeLensCache, CodeLensCache);
132+
registerSingleton(ICodeLensCache, CodeLensCache, false);

src/vs/editor/contrib/peekView/browser/peekView.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ registerSingleton(IPeekViewService, class implements IPeekViewService {
5353
};
5454
this._widgets.set(editor, { widget, listener: widget.onDidClose(remove) });
5555
}
56-
});
56+
}, true);
5757

5858
export namespace PeekContext {
5959
export const inPeekEditor = new RawContextKey<boolean>('inReferenceSearchEditor', true, nls.localize('inReferenceSearchEditor', "Whether the current code editor is embedded inside peek"));

src/vs/editor/standalone/browser/standaloneCodeEditorService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,4 @@ export class StandaloneCodeEditorService extends AbstractCodeEditorService {
103103
}
104104
}
105105

106-
registerSingleton(ICodeEditorService, StandaloneCodeEditorService);
106+
registerSingleton(ICodeEditorService, StandaloneCodeEditorService, false);

src/vs/editor/standalone/browser/standaloneLayoutService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ export class EditorScopedLayoutService extends StandaloneLayoutService {
6363
}
6464
}
6565

66-
registerSingleton(ILayoutService, StandaloneLayoutService);
66+
registerSingleton(ILayoutService, StandaloneLayoutService, false);

src/vs/editor/standalone/browser/standaloneServices.ts

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -959,38 +959,38 @@ export interface IEditorOverrideServices {
959959
[index: string]: any;
960960
}
961961

962-
registerSingleton(IConfigurationService, StandaloneConfigurationService);
963-
registerSingleton(ITextResourceConfigurationService, StandaloneResourceConfigurationService);
964-
registerSingleton(ITextResourcePropertiesService, StandaloneResourcePropertiesService);
965-
registerSingleton(IWorkspaceContextService, StandaloneWorkspaceContextService);
966-
registerSingleton(ILabelService, StandaloneUriLabelService);
967-
registerSingleton(ITelemetryService, StandaloneTelemetryService);
968-
registerSingleton(IDialogService, StandaloneDialogService);
969-
registerSingleton(INotificationService, StandaloneNotificationService);
970-
registerSingleton(IMarkerService, MarkerService);
971-
registerSingleton(ILanguageService, StandaloneLanguageService);
972-
registerSingleton(IStandaloneThemeService, StandaloneThemeService);
973-
registerSingleton(ILogService, StandaloneLogService);
974-
registerSingleton(IModelService, ModelService);
975-
registerSingleton(IMarkerDecorationsService, MarkerDecorationsService);
976-
registerSingleton(IContextKeyService, ContextKeyService);
977-
registerSingleton(IProgressService, StandaloneProgressService);
978-
registerSingleton(IEditorProgressService, StandaloneEditorProgressService);
979-
registerSingleton(IStorageService, InMemoryStorageService);
980-
registerSingleton(IEditorWorkerService, EditorWorkerService);
981-
registerSingleton(IBulkEditService, StandaloneBulkEditService);
982-
registerSingleton(IWorkspaceTrustManagementService, StandaloneWorkspaceTrustManagementService);
983-
registerSingleton(ITextModelService, StandaloneTextModelService);
984-
registerSingleton(IAccessibilityService, AccessibilityService);
985-
registerSingleton(IListService, ListService);
986-
registerSingleton(ICommandService, StandaloneCommandService);
987-
registerSingleton(IKeybindingService, StandaloneKeybindingService);
988-
registerSingleton(IQuickInputService, StandaloneQuickInputService);
989-
registerSingleton(IContextViewService, StandaloneContextViewService);
990-
registerSingleton(IOpenerService, OpenerService);
991-
registerSingleton(IClipboardService, BrowserClipboardService);
992-
registerSingleton(IContextMenuService, StandaloneContextMenuService);
993-
registerSingleton(IMenuService, MenuService);
962+
registerSingleton(IConfigurationService, StandaloneConfigurationService, false);
963+
registerSingleton(ITextResourceConfigurationService, StandaloneResourceConfigurationService, false);
964+
registerSingleton(ITextResourcePropertiesService, StandaloneResourcePropertiesService, false);
965+
registerSingleton(IWorkspaceContextService, StandaloneWorkspaceContextService, false);
966+
registerSingleton(ILabelService, StandaloneUriLabelService, false);
967+
registerSingleton(ITelemetryService, StandaloneTelemetryService, false);
968+
registerSingleton(IDialogService, StandaloneDialogService, false);
969+
registerSingleton(INotificationService, StandaloneNotificationService, false);
970+
registerSingleton(IMarkerService, MarkerService, false);
971+
registerSingleton(ILanguageService, StandaloneLanguageService, false);
972+
registerSingleton(IStandaloneThemeService, StandaloneThemeService, false);
973+
registerSingleton(ILogService, StandaloneLogService, false);
974+
registerSingleton(IModelService, ModelService, false);
975+
registerSingleton(IMarkerDecorationsService, MarkerDecorationsService, false);
976+
registerSingleton(IContextKeyService, ContextKeyService, false);
977+
registerSingleton(IProgressService, StandaloneProgressService, false);
978+
registerSingleton(IEditorProgressService, StandaloneEditorProgressService, false);
979+
registerSingleton(IStorageService, InMemoryStorageService, false);
980+
registerSingleton(IEditorWorkerService, EditorWorkerService, false);
981+
registerSingleton(IBulkEditService, StandaloneBulkEditService, false);
982+
registerSingleton(IWorkspaceTrustManagementService, StandaloneWorkspaceTrustManagementService, false);
983+
registerSingleton(ITextModelService, StandaloneTextModelService, false);
984+
registerSingleton(IAccessibilityService, AccessibilityService, false);
985+
registerSingleton(IListService, ListService, false);
986+
registerSingleton(ICommandService, StandaloneCommandService, false);
987+
registerSingleton(IKeybindingService, StandaloneKeybindingService, false);
988+
registerSingleton(IQuickInputService, StandaloneQuickInputService, false);
989+
registerSingleton(IContextViewService, StandaloneContextViewService, false);
990+
registerSingleton(IOpenerService, OpenerService, false);
991+
registerSingleton(IClipboardService, BrowserClipboardService, false);
992+
registerSingleton(IContextMenuService, StandaloneContextMenuService, false);
993+
registerSingleton(IMenuService, MenuService, false);
994994

995995
/**
996996
* We don't want to eagerly instantiate services because embedders get a one time chance

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);
38+
registerSingleton(IExtensionsScannerService, ExtensionsScannerService, false);

src/vs/platform/instantiation/common/extensions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { BrandedService, ServiceIdentifier } from './instantiation';
88

99
const _registry: [ServiceIdentifier<any>, SyncDescriptor<any>][] = [];
1010

11-
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: new (...services: Services) => T, supportsDelayedInstantiation?: boolean): void;
11+
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctor: new (...services: Services) => T, supportsDelayedInstantiation: boolean): void;
1212
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, descriptor: SyncDescriptor<any>): void;
1313
export function registerSingleton<T, Services extends BrandedService[]>(id: ServiceIdentifier<T>, ctorOrDescriptor: { new(...services: Services): T } | SyncDescriptor<any>, supportsDelayedInstantiation?: boolean): void {
1414
if (!(ctorOrDescriptor instanceof SyncDescriptor)) {

src/vs/platform/undoRedo/common/undoRedoService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1393,4 +1393,4 @@ class WorkspaceVerificationError {
13931393
constructor(public readonly returnValue: Promise<void> | void) { }
13941394
}
13951395

1396-
registerSingleton(IUndoRedoService, UndoRedoService);
1396+
registerSingleton(IUndoRedoService, UndoRedoService, false);

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,26 @@ 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);
33-
registerSingleton(ILogService, ExtHostLogService);
34-
registerSingleton(IExtHostApiDeprecationService, ExtHostApiDeprecationService);
35-
registerSingleton(IExtHostCommands, ExtHostCommands);
36-
registerSingleton(IExtHostConfiguration, ExtHostConfiguration);
37-
registerSingleton(IExtHostConsumerFileSystem, ExtHostConsumerFileSystem);
38-
registerSingleton(IExtHostDebugService, WorkerExtHostDebugService);
39-
registerSingleton(IExtHostDecorations, ExtHostDecorations);
40-
registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors);
41-
registerSingleton(IExtHostFileSystemInfo, ExtHostFileSystemInfo);
42-
registerSingleton(IExtHostOutputService, ExtHostOutputService);
43-
registerSingleton(IExtHostSearch, ExtHostSearch);
44-
registerSingleton(IExtHostStorage, ExtHostStorage);
45-
registerSingleton(IExtHostTask, WorkerExtHostTask);
46-
registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService);
47-
registerSingleton(IExtHostTunnelService, ExtHostTunnelService);
48-
registerSingleton(IExtHostWindow, ExtHostWindow);
49-
registerSingleton(IExtHostWorkspace, ExtHostWorkspace);
50-
registerSingleton(IExtHostSecretState, ExtHostSecretState);
51-
registerSingleton(IExtHostTelemetry, ExtHostTelemetry);
52-
registerSingleton(IExtHostTelemetryLogService, ExtHostTelemetryLogService);
53-
registerSingleton(IExtHostEditorTabs, ExtHostEditorTabs);
54-
registerSingleton(IExtHostVariableResolverProvider, ExtHostVariableResolverProviderService);
32+
registerSingleton(ILoggerService, ExtHostLoggerService, false);
33+
registerSingleton(ILogService, ExtHostLogService, false);
34+
registerSingleton(IExtHostApiDeprecationService, ExtHostApiDeprecationService, false);
35+
registerSingleton(IExtHostCommands, ExtHostCommands, false);
36+
registerSingleton(IExtHostConfiguration, ExtHostConfiguration, false);
37+
registerSingleton(IExtHostConsumerFileSystem, ExtHostConsumerFileSystem, false);
38+
registerSingleton(IExtHostDebugService, WorkerExtHostDebugService, false);
39+
registerSingleton(IExtHostDecorations, ExtHostDecorations, false);
40+
registerSingleton(IExtHostDocumentsAndEditors, ExtHostDocumentsAndEditors, false);
41+
registerSingleton(IExtHostFileSystemInfo, ExtHostFileSystemInfo, false);
42+
registerSingleton(IExtHostOutputService, ExtHostOutputService, false);
43+
registerSingleton(IExtHostSearch, ExtHostSearch, false);
44+
registerSingleton(IExtHostStorage, ExtHostStorage, false);
45+
registerSingleton(IExtHostTask, WorkerExtHostTask, false);
46+
registerSingleton(IExtHostTerminalService, WorkerExtHostTerminalService, false);
47+
registerSingleton(IExtHostTunnelService, ExtHostTunnelService, false);
48+
registerSingleton(IExtHostWindow, ExtHostWindow, false);
49+
registerSingleton(IExtHostWorkspace, ExtHostWorkspace, false);
50+
registerSingleton(IExtHostSecretState, ExtHostSecretState, false);
51+
registerSingleton(IExtHostTelemetry, ExtHostTelemetry, false);
52+
registerSingleton(IExtHostTelemetryLogService, ExtHostTelemetryLogService, false);
53+
registerSingleton(IExtHostEditorTabs, ExtHostEditorTabs, false);
54+
registerSingleton(IExtHostVariableResolverProvider, ExtHostVariableResolverProviderService, false);

0 commit comments

Comments
 (0)