Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Service container registrations update #10475

Merged
merged 8 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,242 changes: 2,121 additions & 2,121 deletions TELEMETRY.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/extension.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import {
import { createDeferred } from './platform/common/utils/async';
import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/startupTelemetry';
import { sendErrorTelemetry, sendStartupTelemetry } from './telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.node';
Expand Down
2 changes: 1 addition & 1 deletion src/extension.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import {
import { createDeferred } from './platform/common/utils/async';
import { Common, OutputChannelNames } from './platform/common/utils/localize';
import { IServiceContainer, IServiceManager } from './platform/ioc/types';
import { sendErrorTelemetry, sendStartupTelemetry } from './platform/startupTelemetry';
import { sendErrorTelemetry, sendStartupTelemetry } from './telemetry/startupTelemetry';
import { noop } from './platform/common/utils/misc';
import { PythonExtension } from './webviews/webview-side/common/constants';
import { registerTypes as registerPlatformTypes } from './platform/serviceRegistry.web';
Expand Down
10 changes: 9 additions & 1 deletion src/intellisense/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,19 @@ import { IExtensionSingleActivationService, IExtensionSyncActivationService } fr
import { IServiceManager } from '../platform/ioc/types';
import { NotebookCellBangInstallDiagnosticsProvider } from './diagnosticsProvider';
import { IntellisenseProvider } from './intellisenseProvider.node';
import { LogReplayService } from './logReplayService.node';
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logReplayService registered directly in intellisense

import { NotebookPythonPathService } from './notebookPythonPathService.node';
import { PythonKernelCompletionProvider } from './pythonKernelCompletionProvider';
import { PythonKernelCompletionProviderRegistration } from './pythonKernelCompletionProviderRegistration';

export function registerTypes(serviceManager: IServiceManager, _isDevMode: boolean) {
export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) {
if (isDevMode) {
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
LogReplayService
);
}

serviceManager.addSingleton<PythonKernelCompletionProvider>(
PythonKernelCompletionProvider,
PythonKernelCompletionProvider
Expand Down
8 changes: 7 additions & 1 deletion src/interactive-window/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { ITracebackFormatter } from '../kernels/types';
import { IExtensionSyncActivationService, IExtensionSingleActivationService } from '../platform/activation/types';
import { IDataScienceCommandListener } from '../platform/common/types';
import { IDataScienceCommandListener, IJupyterExtensionBanner } from '../platform/common/types';
import { IServiceManager } from '../platform/ioc/types';
import { CommandRegistry } from './commands/commandRegistry';
import { CodeGeneratorFactory } from './editor-integration/codeGeneratorFactory';
Expand All @@ -28,6 +28,7 @@ import { InteractiveWindowTracebackFormatter } from './outputs/tracebackFormatte
import { IInteractiveWindowDebugger, IInteractiveWindowDebuggingManager, IInteractiveWindowProvider } from './types';
import { InteractiveWindowDebugger } from './debugger/interactiveWindowDebugger.node';
import { InteractiveWindowDebuggingManager } from './debugger/jupyter/debuggingManager';
import { BANNER_NAME_INTERACTIVE_SHIFTENTER, InteractiveShiftEnterBanner } from './shiftEnterBanner';

export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IInteractiveWindowProvider>(IInteractiveWindowProvider, InteractiveWindowProvider);
Expand Down Expand Up @@ -63,4 +64,9 @@ export function registerTypes(serviceManager: IServiceManager) {
undefined,
[IExtensionSingleActivationService]
);
serviceManager.addSingleton<IJupyterExtensionBanner>(
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InteractiveShiftEnterBanner registered directly in src/interactive-window

IJupyterExtensionBanner,
InteractiveShiftEnterBanner,
BANNER_NAME_INTERACTIVE_SHIFTENTER
);
}
2 changes: 2 additions & 0 deletions src/interactive-window/shiftEnterBanner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { IJupyterExtensionBanner, IPersistentStateFactory, IConfigurationService
import * as localize from '../platform/common/utils/localize';
import { sendTelemetryEvent, captureTelemetry } from '../telemetry';

export const BANNER_NAME_INTERACTIVE_SHIFTENTER: string = 'InteractiveShiftEnterBanner';

export enum InteractiveShiftEnterStateKeys {
ShowBanner = 'InteractiveShiftEnterBanner'
}
Expand Down
10 changes: 9 additions & 1 deletion src/kernels/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { KernelVariables } from './variables/kernelVariables';
import { PreWarmActivatedJupyterEnvironmentVariables } from './variables/preWarmVariables.node';
import { PythonVariablesRequester } from './variables/pythonVariableRequester';
import { MultiplexingDebugService } from './debugger/multiplexingDebugService';
import { IJupyterDebugService } from './debugger/types';
import { IDebugLocationTracker, IDebugLocationTrackerFactory, IJupyterDebugService } from './debugger/types';
import { IKernelDependencyService, IKernelFinder, IKernelProvider } from './types';
import { IJupyterVariables, IKernelVariableRequester } from './variables/types';
import { KernelCrashMonitor } from './kernelCrashMonitor';
Expand All @@ -40,8 +40,12 @@ import { KernelProvider } from './kernelProvider.node';
import { KernelFinder } from './kernelFinder.node';
import { ServerConnectionType } from './jupyter/launcher/serverConnectionType';
import { CellOutputDisplayIdTracker } from './execution/cellDisplayIdTracker';
import { DebugLocationTrackerFactory } from './debugger/debugLocationTrackerFactory';
import { Activation } from './activation.node';

export function registerTypes(serviceManager: IServiceManager, isDevMode: boolean) {
serviceManager.addSingleton<IExtensionSingleActivationService>(IExtensionSingleActivationService, Activation);

serviceManager.addSingleton<IRawNotebookSupportedService>(
IRawNotebookSupportedService,
RawNotebookSupportedService
Expand Down Expand Up @@ -125,4 +129,8 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
const rawService = serviceManager.get<IRawNotebookSupportedService>(IRawNotebookSupportedService);
setSharedProperty('rawKernelSupported', rawService.isSupported ? 'true' : 'false');
serviceManager.addSingleton<CellOutputDisplayIdTracker>(CellOutputDisplayIdTracker, CellOutputDisplayIdTracker);

serviceManager.addSingleton<IDebugLocationTracker>(IDebugLocationTracker, DebugLocationTrackerFactory, undefined, [
IDebugLocationTrackerFactory
]);
}
8 changes: 7 additions & 1 deletion src/kernels/serviceRegistry.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ import { KernelProvider } from './kernelProvider.web';
import { KernelFinder } from './kernelFinder.web';
import { PreferredRemoteKernelIdProvider } from './jupyter/preferredRemoteKernelIdProvider';
import { MultiplexingDebugService } from './debugger/multiplexingDebugService';
import { IJupyterDebugService } from './debugger/types';
import { IDebugLocationTracker, IDebugLocationTrackerFactory, IJupyterDebugService } from './debugger/types';
import { DebuggerVariables } from './variables/debuggerVariables';
import { IJupyterVariables, IKernelVariableRequester } from './variables/types';
import { KernelVariables } from './variables/kernelVariables';
import { JupyterVariables } from './variables/jupyterVariables';
import { PythonVariablesRequester } from './variables/pythonVariableRequester';
import { CellOutputDisplayIdTracker } from './execution/cellDisplayIdTracker';
import { DebugLocationTrackerFactory } from './debugger/debugLocationTrackerFactory';

@injectable()
class RawNotebookSupportedService implements IRawNotebookSupportedService {
Expand Down Expand Up @@ -86,4 +87,9 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea
registerJupyterTypes(serviceManager, isDevMode);

serviceManager.addSingleton<CellOutputDisplayIdTracker>(CellOutputDisplayIdTracker, CellOutputDisplayIdTracker);

// debugging
serviceManager.addSingleton<IDebugLocationTracker>(IDebugLocationTracker, DebugLocationTrackerFactory, undefined, [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebugLocationTrackerFactory registered in src/kernels.

IDebugLocationTrackerFactory
]);
}
7 changes: 6 additions & 1 deletion src/notebooks/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { CondaControllerRefresher } from './controllers/condaControllerRefresher
import { RemoteKernelControllerWatcher } from './controllers/remoteKernelControllerWatcher';
import { ITracebackFormatter } from '../kernels/types';
import { NotebookTracebackFormatter } from './outputs/tracebackFormatter';
import { IJupyterDebugService } from '../kernels/debugger/types';
import { IDebuggingManager, IJupyterDebugService } from '../kernels/debugger/types';
import { Identifiers } from '../platform/common/constants';
import { JupyterDebugService } from './debugger/jupyterDebugService.node';
import { NotebookIPyWidgetCoordinator } from './controllers/notebookIPyWidgetCoordinator';
Expand All @@ -29,6 +29,7 @@ import { JupyterServerSelectorCommand } from './serverSelector';
import { InterpreterPackageTracker } from './telemetry/interpreterPackageTracker';
import { NotebookCellLanguageService } from './languages/cellLanguageService';
import { EmptyNotebookCellLanguageService } from './languages/emptyNotebookCellLanguageService';
import { DebuggingManager } from './debugger/debuggingManager';

export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IExtensionSingleActivationService>(IExtensionSingleActivationService, RemoteSwitcher);
Expand Down Expand Up @@ -89,4 +90,8 @@ export function registerTypes(serviceManager: IServiceManager) {
IExtensionSingleActivationService,
EmptyNotebookCellLanguageService
);

serviceManager.addSingleton<IDebuggingManager>(IDebuggingManager, DebuggingManager, undefined, [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DebuggingManager registered directly in src/notebooks

IExtensionSingleActivationService
]);
}
6 changes: 6 additions & 0 deletions src/notebooks/serviceRegistry.web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { NotebookCommandListener } from './notebookCommandListener';
import { InterpreterPackageTracker } from './telemetry/interpreterPackageTracker';
import { NotebookCellLanguageService } from './languages/cellLanguageService';
import { EmptyNotebookCellLanguageService } from './languages/emptyNotebookCellLanguageService';
import { IDebuggingManager } from '../kernels/debugger/types';
import { DebuggingManager } from './debugger/debuggingManager';
import { ErrorRendererCommunicationHandler } from './outputs/errorRendererComms';

export function registerTypes(serviceManager: IServiceManager) {
Expand Down Expand Up @@ -71,6 +73,10 @@ export function registerTypes(serviceManager: IServiceManager) {
IExtensionSingleActivationService,
EmptyNotebookCellLanguageService
);

serviceManager.addSingleton<IDebuggingManager>(IDebuggingManager, DebuggingManager, undefined, [
IExtensionSingleActivationService
]);
serviceManager.addSingleton<IExtensionSyncActivationService>(
IExtensionSyncActivationService,
ErrorRendererCommunicationHandler
Expand Down
8 changes: 1 addition & 7 deletions src/platform/activation/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

import { BANNER_NAME_INTERACTIVE_SHIFTENTER, IJupyterExtensionBanner, ISurveyBanner } from '../common/types';
import { ISurveyBanner } from '../common/types';
import { DataScienceSurveyBanner } from '../common/dataScienceSurveyBanner.node';
import { IServiceManager } from '../ioc/types';
import { ExtensionActivationManager } from './activationManager';

import { IExtensionActivationManager, IExtensionSingleActivationService } from './types';
import { InteractiveShiftEnterBanner } from '../../interactive-window/shiftEnterBanner';
import { WorkspaceActivation } from './workspaceActivation.node';

// eslint-disable-next-line
export function registerTypes(serviceManager: IServiceManager) {
serviceManager.add<IExtensionActivationManager>(IExtensionActivationManager, ExtensionActivationManager);
serviceManager.addSingleton<ISurveyBanner>(ISurveyBanner, DataScienceSurveyBanner);
serviceManager.addBinding(ISurveyBanner, IExtensionSingleActivationService);
serviceManager.addSingleton<IJupyterExtensionBanner>(
IJupyterExtensionBanner,
InteractiveShiftEnterBanner,
BANNER_NAME_INTERACTIVE_SHIFTENTER
);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
WorkspaceActivation
Expand Down
2 changes: 1 addition & 1 deletion src/platform/common/application/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
ViewColumn
} from 'vscode';
import { IShowDataViewerFromVariablePanel } from '../../messageTypes';
import { Commands as DSCommands } from '../../../webviews/webview-side/common/constants';
import { Commands as DSCommands } from '../../../platform/common/constants';
import { PythonEnvironment } from '../../pythonEnvironments/info';
import { CommandSource } from '../../testing/common/constants';
import { Channel } from './types';
Expand Down
1 change: 0 additions & 1 deletion src/platform/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ export interface IJupyterExtensionBanner {
isEnabled(type: BannerType): boolean;
showBanner(type: BannerType): Promise<void>;
}
export const BANNER_NAME_INTERACTIVE_SHIFTENTER: string = 'InteractiveShiftEnterBanner';

export const ISurveyBanner = Symbol('ISurveyBanner');
export interface ISurveyBanner extends IExtensionSingleActivationService, IJupyterExtensionBanner {}
Expand Down
2 changes: 1 addition & 1 deletion src/platform/messageTypes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'use strict';
import { Uri } from 'vscode';
import type { KernelMessage } from '@jupyterlab/services';
import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry } from '../webviews/webview-side/common/constants';
import { NativeKeyboardCommandTelemetry, NativeMouseCommandTelemetry } from '../platform/common/constants';
import {
IVariableExplorerHeight,
CommonActionType
Expand Down
43 changes: 1 addition & 42 deletions src/platform/serviceRegistry.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,11 @@ import { registerTypes as registerTerminalTypes } from './terminals/serviceRegis
import { registerTypes as registerActivationTypes } from './activation/serviceRegistry.node';
import { registerTypes as registerDevToolTypes } from './devTools/serviceRegistry';
import { DataScienceStartupTime } from './common/constants';
import { LogReplayService } from '../intellisense/logReplayService.node';
import { Activation } from '../kernels/activation.node';
import { DataViewer } from '../webviews/extension-side/dataviewer/dataViewer.node';
import { DataViewerDependencyService } from '../webviews/extension-side/dataviewer/dataViewerDependencyService.node';
import { DataViewerFactory } from '../webviews/extension-side/dataviewer/dataViewerFactory';
import {
IDataViewer,
IDataViewerDependencyService,
IDataViewerFactory
} from '../webviews/extension-side/dataviewer/types';
import { PlotViewer } from '../webviews/extension-side/plotting/plotViewer.node';
import { PlotViewerProvider } from '../webviews/extension-side/plotting/plotViewerProvider.node';
import { IPlotViewer, IPlotViewerProvider } from '../webviews/extension-side/plotting/types';
import { NotebookWatcher } from '../webviews/extension-side/variablesView/notebookWatcher';
import { INotebookWatcher } from '../webviews/extension-side/variablesView/types';
import { IExtensionSingleActivationService, IExtensionSyncActivationService } from './activation/types';
import { ExtensionRecommendationService } from './common/extensionRecommendation.node';
import { GlobalActivation } from './common/globalActivation';
import { PreReleaseChecker } from './common/prereleaseChecker.node';
import { IConfigurationService, IDataScienceCommandListener, IExtensionContext } from './common/types';
import { DebugLocationTrackerFactory } from '../kernels/debugger/debugLocationTrackerFactory';
import { DataScienceErrorHandler } from './errors/errorHandler';
import { IDataScienceErrorHandler } from './errors/types';
import { ExportBase } from './export/exportBase.node';
Expand All @@ -55,11 +39,8 @@ import { IFileSystem } from './common/platform/types';
import { IFileSystemNode } from './common/platform/types.node';
import { FileSystem } from './common/platform/fileSystem.node';
import { WorkspaceService } from './common/application/workspace.node';
import { ExtensionSideRenderer, IExtensionSideRenderer } from '../webviews/extension-side/renderer';
import { OutputCommandListener } from './logging/outputCommandListener';
import { ExportUtilBase } from './export/exportUtil';
import { DebuggingManager } from '../notebooks/debugger/debuggingManager';
import { IDebuggingManager, IDebugLocationTracker, IDebugLocationTrackerFactory } from '../kernels/debugger/types';

export function registerTypes(context: IExtensionContext, serviceManager: IServiceManager, isDevMode: boolean) {
serviceManager.addSingleton<FileSystem>(FileSystem, FileSystem);
Expand All @@ -78,27 +59,9 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi

// Root platform types
serviceManager.addSingletonInstance<number>(DataScienceStartupTime, Date.now());
serviceManager.addSingletonInstance<IExtensionSideRenderer>(IExtensionSideRenderer, new ExtensionSideRenderer());
serviceManager.addSingleton<IDataScienceErrorHandler>(IDataScienceErrorHandler, DataScienceErrorHandler);
serviceManager.add<IDataViewer>(IDataViewer, DataViewer);
serviceManager.add<IPlotViewer>(IPlotViewer, PlotViewer);
serviceManager.addSingleton<IDataViewerDependencyService>(
IDataViewerDependencyService,
DataViewerDependencyService
);

serviceManager.addSingleton<IExtensionSingleActivationService>(IExtensionSingleActivationService, GlobalActivation);
serviceManager.addSingleton<IDataViewerFactory>(IDataViewerFactory, DataViewerFactory);
serviceManager.addSingleton<IDebugLocationTracker>(IDebugLocationTracker, DebugLocationTrackerFactory, undefined, [
IDebugLocationTrackerFactory
]);
serviceManager.addSingleton<IExtensionSingleActivationService>(IExtensionSingleActivationService, Activation);
if (isDevMode) {
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
LogReplayService
);
}
serviceManager.addSingleton<IPlotViewerProvider>(IPlotViewerProvider, PlotViewerProvider);
serviceManager.addSingleton<IStatusProvider>(IStatusProvider, StatusProvider);
serviceManager.addSingleton<ProgressReporter>(ProgressReporter, ProgressReporter);
serviceManager.addSingleton<IFileConverter>(IFileConverter, FileConverter);
Expand All @@ -114,7 +77,6 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi
serviceManager.addSingleton<ExportUtilBase>(ExportUtilBase, ExportUtilBase);
serviceManager.addSingleton<ExportUtil>(ExportUtil, ExportUtil);
serviceManager.addSingleton<IExportDialog>(IExportDialog, ExportDialog);
serviceManager.addSingleton<INotebookWatcher>(INotebookWatcher, NotebookWatcher);
serviceManager.addSingleton<IExtensionSyncActivationService>(
IExtensionSyncActivationService,
ExtensionRecommendationService
Expand All @@ -123,9 +85,6 @@ export function registerTypes(context: IExtensionContext, serviceManager: IServi
IExtensionSyncActivationService,
KernelProgressReporter
);
serviceManager.addSingleton<IDebuggingManager>(IDebuggingManager, DebuggingManager, undefined, [
IExtensionSingleActivationService
]);
serviceManager.addSingleton<IExtensionSingleActivationService>(
IExtensionSingleActivationService,
PreReleaseChecker
Expand Down
Loading