From 2f4c4fbc9ad75e838919a00bb1d7ec90adef6982 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Wed, 8 Jun 2022 13:48:29 -0700 Subject: [PATCH] Move debugger files around so they use the appropriate folders (#10373) * Move debugger files around to eliminate notebooks reference * Update telemetry --- TELEMETRY.md | 6 +++--- .../debugger/jupyter/debugCellControllers.ts | 2 +- .../debugger/jupyter/debuggingManager.ts | 4 ++-- src/{notebooks => kernels}/debugger/helper.ts | 4 ++-- src/kernels/debugger/kernelDebugAdapterBase.ts | 7 +------ src/kernels/serviceRegistry.node.ts | 6 ------ src/notebooks/debugger/debugCellControllers.ts | 2 +- src/notebooks/debugger/debuggingManager.ts | 4 ++-- .../debugger/debuggingManagerBase.ts | 14 +++++++------- src/notebooks/debugger/runByLineController.ts | 2 +- src/notebooks/serviceRegistry.node.ts | 8 ++++++++ src/{notebooks => platform}/debugger/debugger.ts | 0 src/test/debugger/jupyter/helpers.unit.test.ts | 2 +- 13 files changed, 29 insertions(+), 32 deletions(-) rename src/{notebooks => kernels}/debugger/helper.ts (98%) rename src/{kernels => notebooks}/debugger/debuggingManagerBase.ts (94%) rename src/{notebooks => platform}/debugger/debugger.ts (100%) diff --git a/TELEMETRY.md b/TELEMETRY.md index c79c8201916..c91f7558772 100644 --- a/TELEMETRY.md +++ b/TELEMETRY.md @@ -421,7 +421,7 @@ No properties for event ## Locations Used -[src/kernels/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/debugger/debuggingManagerBase.ts) +[src/notebooks/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/debugger/debuggingManagerBase.ts) ```typescript ); @@ -505,7 +505,7 @@ No properties for event ## Locations Used -[src/kernels/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/debugger/debuggingManagerBase.ts) +[src/notebooks/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/debugger/debuggingManagerBase.ts) ```typescript 'https://github.com/microsoft/vscode-jupyter/wiki/Setting-Up-Run-by-Line-and-Debugging-for-Notebooks' ); @@ -583,7 +583,7 @@ No description provided ## Locations Used -[src/kernels/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/kernels/debugger/debuggingManagerBase.ts) +[src/notebooks/debugger/debuggingManagerBase.ts](https://github.com/microsoft/vscode-jupyter/tree/main/src/notebooks/debugger/debuggingManagerBase.ts) ```typescript } diff --git a/src/interactive-window/debugger/jupyter/debugCellControllers.ts b/src/interactive-window/debugger/jupyter/debugCellControllers.ts index c8482b130d6..bcdeb2fd90b 100644 --- a/src/interactive-window/debugger/jupyter/debugCellControllers.ts +++ b/src/interactive-window/debugger/jupyter/debugCellControllers.ts @@ -6,7 +6,7 @@ import { DebugProtocol } from 'vscode-debugprotocol'; import { IDebuggingDelegate, IKernelDebugAdapter } from '../../../kernels/debugger/types'; import { DebuggingTelemetry } from '../../../kernels/debugger/constants'; import { IKernel } from '../../../kernels/types'; -import { cellDebugSetup } from '../../../notebooks/debugger/helper'; +import { cellDebugSetup } from '../../../kernels/debugger/helper'; import { createDeferred } from '../../../platform/common/utils/async'; import { sendTelemetryEvent } from '../../../telemetry'; import { getInteractiveCellMetadata } from '../../helpers'; diff --git a/src/interactive-window/debugger/jupyter/debuggingManager.ts b/src/interactive-window/debugger/jupyter/debuggingManager.ts index 7a559275c02..9fce5ba2daf 100644 --- a/src/interactive-window/debugger/jupyter/debuggingManager.ts +++ b/src/interactive-window/debugger/jupyter/debuggingManager.ts @@ -21,7 +21,7 @@ import { IDebugLocationTrackerFactory } from '../../../kernels/debugger/types'; import { IKernelProvider } from '../../../kernels/types'; -import { IpykernelCheckResult, assertIsDebugConfig } from '../../../notebooks/debugger/helper'; +import { IpykernelCheckResult, assertIsDebugConfig } from '../../../kernels/debugger/helper'; import { KernelDebugAdapter } from './kernelDebugAdapter'; import { INotebookControllerManager } from '../../../notebooks/types'; import { IExtensionSingleActivationService } from '../../../platform/activation/types'; @@ -31,7 +31,7 @@ import { DataScience } from '../../../platform/common/utils/localize'; import { traceInfoIfCI, traceInfo, traceError } from '../../../platform/logging'; import * as path from '../../../platform/vscode-path/path'; import { DebugCellController } from './debugCellControllers'; -import { DebuggingManagerBase } from '../../../kernels/debugger/debuggingManagerBase'; +import { DebuggingManagerBase } from '../../../notebooks/debugger/debuggingManagerBase'; import { IConfigurationService } from '../../../platform/common/types'; import { IFileGeneratedCodes } from '../../editor-integration/types'; import { buildSourceMap } from '../helper'; diff --git a/src/notebooks/debugger/helper.ts b/src/kernels/debugger/helper.ts similarity index 98% rename from src/notebooks/debugger/helper.ts rename to src/kernels/debugger/helper.ts index 4493f549fe3..ed3014685ea 100644 --- a/src/notebooks/debugger/helper.ts +++ b/src/kernels/debugger/helper.ts @@ -2,8 +2,8 @@ // Licensed under the MIT License. import { DebugProtocol } from 'vscode-debugprotocol'; -import { IKernelDebugAdapter, IKernelDebugAdapterConfig, KernelDebugMode } from '../../kernels/debugger/types'; -import { IKernel } from '../../kernels/types'; +import { IKernelDebugAdapter, IKernelDebugAdapterConfig, KernelDebugMode } from './types'; +import { IKernel } from '../types'; export enum IpykernelCheckResult { Unknown, diff --git a/src/kernels/debugger/kernelDebugAdapterBase.ts b/src/kernels/debugger/kernelDebugAdapterBase.ts index 275fe8d8e5d..ce4b9ca73fa 100644 --- a/src/kernels/debugger/kernelDebugAdapterBase.ts +++ b/src/kernels/debugger/kernelDebugAdapterBase.ts @@ -35,12 +35,7 @@ import { } from './types'; import { sendTelemetryEvent } from '../../telemetry'; import { traceError, traceInfo, traceInfoIfCI, traceVerbose, traceWarning } from '../../platform/logging'; -import { - assertIsDebugConfig, - isShortNamePath, - shortNameMatchesLongName, - getMessageSourceAndHookIt -} from '../../notebooks/debugger/helper'; +import { assertIsDebugConfig, isShortNamePath, shortNameMatchesLongName, getMessageSourceAndHookIt } from './helper'; import { IDisposable } from '../../platform/common/types'; import { executeSilently } from '../helpers'; diff --git a/src/kernels/serviceRegistry.node.ts b/src/kernels/serviceRegistry.node.ts index 16ce253956c..7449ccc393f 100644 --- a/src/kernels/serviceRegistry.node.ts +++ b/src/kernels/serviceRegistry.node.ts @@ -12,7 +12,6 @@ import { IProtocolParser } from '../platform/debugger/extension/types.node'; import { IServiceManager } from '../platform/ioc/types'; import { setSharedProperty } from '../telemetry'; import { InteractiveWindowDebugger } from '../interactive-window/debugger/interactiveWindowDebugger.node'; -import { JupyterDebugService } from '../notebooks/debugger/jupyterDebugService.node'; import { registerInstallerTypes } from './installer/serviceRegistry.node'; import { KernelDependencyService } from './kernelDependencyService.node'; import { JupyterPaths } from './raw/finder/jupyterPaths.node'; @@ -104,11 +103,6 @@ export function registerTypes(serviceManager: IServiceManager, isDevMode: boolea MultiplexingDebugService, Identifiers.MULTIPLEXING_DEBUGSERVICE ); - serviceManager.addSingleton( - IJupyterDebugService, - JupyterDebugService, - Identifiers.RUN_BY_LINE_DEBUGSERVICE - ); serviceManager.add(IJupyterVariableDataProvider, JupyterVariableDataProvider); serviceManager.addSingleton( IJupyterVariableDataProviderFactory, diff --git a/src/notebooks/debugger/debugCellControllers.ts b/src/notebooks/debugger/debugCellControllers.ts index d2e59147df0..e98e32f6fa9 100644 --- a/src/notebooks/debugger/debugCellControllers.ts +++ b/src/notebooks/debugger/debugCellControllers.ts @@ -7,7 +7,7 @@ import { ICommandManager } from '../../platform/common/application/types'; import { IKernel } from '../../kernels/types'; import { sendTelemetryEvent } from '../../telemetry'; import { DebuggingTelemetry } from '../../kernels/debugger/constants'; -import { cellDebugSetup } from './helper'; +import { cellDebugSetup } from '../../kernels/debugger/helper'; import { IDebuggingDelegate, IKernelDebugAdapter } from '../../kernels/debugger/types'; export class DebugCellController implements IDebuggingDelegate { diff --git a/src/notebooks/debugger/debuggingManager.ts b/src/notebooks/debugger/debuggingManager.ts index db90ddbef24..2853a72d219 100644 --- a/src/notebooks/debugger/debuggingManager.ts +++ b/src/notebooks/debugger/debuggingManager.ts @@ -30,9 +30,9 @@ import { traceError, traceInfo, traceInfoIfCI } from '../../platform/logging'; import { DataScience } from '../../platform/common/utils/localize'; import { DebugCellController } from './debugCellControllers'; import { KernelDebugAdapter } from './kernelDebugAdapter'; -import { assertIsDebugConfig, IpykernelCheckResult } from './helper'; +import { assertIsDebugConfig, IpykernelCheckResult } from '../../kernels/debugger/helper'; import { IDebuggingManager, IKernelDebugAdapterConfig, KernelDebugMode } from '../../kernels/debugger/types'; -import { DebuggingManagerBase } from '../../kernels/debugger/debuggingManagerBase'; +import { DebuggingManagerBase } from './debuggingManagerBase'; /** * The DebuggingManager maintains the mapping between notebook documents and debug sessions. diff --git a/src/kernels/debugger/debuggingManagerBase.ts b/src/notebooks/debugger/debuggingManagerBase.ts similarity index 94% rename from src/kernels/debugger/debuggingManagerBase.ts rename to src/notebooks/debugger/debuggingManagerBase.ts index 6e8452d045d..f53e125b94c 100644 --- a/src/kernels/debugger/debuggingManagerBase.ts +++ b/src/notebooks/debugger/debuggingManagerBase.ts @@ -14,18 +14,18 @@ import { EventEmitter, NotebookCell } from 'vscode'; -import { IKernel, IKernelProvider } from '../types'; +import { IKernel, IKernelProvider } from '../../kernels/types'; import { IDisposable } from '../../platform/common/types'; import { IApplicationShell, ICommandManager, IVSCodeNotebook } from '../../platform/common/application/types'; -import { DebuggingTelemetry } from './constants'; +import { DebuggingTelemetry } from '../../kernels/debugger/constants'; import { sendTelemetryEvent } from '../../telemetry'; import { traceError, traceInfoIfCI } from '../../platform/logging'; import { DataScience } from '../../platform/common/utils/localize'; -import { IKernelDebugAdapterConfig } from './types'; -import { Debugger } from '../../notebooks/debugger/debugger'; -import { KernelDebugAdapterBase } from './kernelDebugAdapterBase'; -import { INotebookControllerManager } from '../../notebooks/types'; -import { IpykernelCheckResult, isUsingIpykernel6OrLater } from '../../notebooks/debugger/helper'; +import { IKernelDebugAdapterConfig } from '../../kernels/debugger/types'; +import { Debugger } from '../../platform/debugger/debugger'; +import { KernelDebugAdapterBase } from '../../kernels/debugger/kernelDebugAdapterBase'; +import { INotebookControllerManager } from '../types'; +import { IpykernelCheckResult, isUsingIpykernel6OrLater } from '../../kernels/debugger/helper'; /** * The DebuggingManager maintains the mapping between notebook documents and debug sessions. diff --git a/src/notebooks/debugger/runByLineController.ts b/src/notebooks/debugger/runByLineController.ts index 18e3ecccecc..98a6944f393 100644 --- a/src/notebooks/debugger/runByLineController.ts +++ b/src/notebooks/debugger/runByLineController.ts @@ -13,7 +13,7 @@ import { DebuggingTelemetry } from '../../kernels/debugger/constants'; import { traceInfoIfCI, traceVerbose } from '../../platform/logging'; import { noop } from '../../platform/common/utils/misc'; import { Commands } from '../../platform/common/constants'; -import { cellDebugSetup } from './helper'; +import { cellDebugSetup } from '../../kernels/debugger/helper'; import { IDebuggingDelegate, IKernelDebugAdapter, KernelDebugMode } from '../../kernels/debugger/types'; export class RunByLineController implements IDebuggingDelegate { diff --git a/src/notebooks/serviceRegistry.node.ts b/src/notebooks/serviceRegistry.node.ts index 2e01a7470cf..44850d4a769 100644 --- a/src/notebooks/serviceRegistry.node.ts +++ b/src/notebooks/serviceRegistry.node.ts @@ -24,6 +24,9 @@ import { IntellisenseProvider } from '../intellisense/intellisenseProvider.node' import { RemoteKernelControllerWatcher } from './controllers/remoteKernelControllerWatcher'; import { ITracebackFormatter } from '../kernels/types'; import { NotebookTracebackFormatter } from './outputs/tracebackFormatter'; +import { IJupyterDebugService } from '../kernels/debugger/types'; +import { Identifiers } from '../platform/common/constants'; +import { JupyterDebugService } from './debugger/jupyterDebugService.node'; import { NotebookIPyWidgetCoordinator } from './controllers/notebookIPyWidgetCoordinator'; export function registerTypes(serviceManager: IServiceManager) { @@ -64,6 +67,11 @@ export function registerTypes(serviceManager: IServiceManager) { RemoteKernelControllerWatcher ); serviceManager.addSingleton(ITracebackFormatter, NotebookTracebackFormatter); + serviceManager.addSingleton( + IJupyterDebugService, + JupyterDebugService, + Identifiers.RUN_BY_LINE_DEBUGSERVICE + ); serviceManager.addSingleton( NotebookIPyWidgetCoordinator, NotebookIPyWidgetCoordinator diff --git a/src/notebooks/debugger/debugger.ts b/src/platform/debugger/debugger.ts similarity index 100% rename from src/notebooks/debugger/debugger.ts rename to src/platform/debugger/debugger.ts diff --git a/src/test/debugger/jupyter/helpers.unit.test.ts b/src/test/debugger/jupyter/helpers.unit.test.ts index 00dfcd59a90..e5301595fdf 100644 --- a/src/test/debugger/jupyter/helpers.unit.test.ts +++ b/src/test/debugger/jupyter/helpers.unit.test.ts @@ -2,7 +2,7 @@ // Licensed under the MIT License. import { expect } from 'chai'; -import { isShortNamePath } from '../../../notebooks/debugger/helper'; +import { isShortNamePath } from '../../../kernels/debugger/helper'; suite('Debugging - Helpers', () => { suite('isShortNamePath', async () => {