From 302b64529971dc35f986b0d5c7bb0eb10c1d562a Mon Sep 17 00:00:00 2001 From: David Kutugata Date: Thu, 26 Aug 2021 16:28:46 -0700 Subject: [PATCH] add setting for bringing up the variable view --- package.json | 6 ++++++ src/client/common/configSettings.ts | 2 ++ src/client/common/types.ts | 1 + src/client/debugger/jupyter/debuggingManager.ts | 8 +++++--- src/client/debugger/jupyter/kernelDebugAdapter.ts | 10 +++++++--- 5 files changed, 21 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index 59eb2018b7b..07d798280a1 100644 --- a/package.json +++ b/package.json @@ -1403,6 +1403,12 @@ "description": "Enables the preview debugging experience. Set to true to enable the debugging mode button on native notebooks. Your selected kernel should also have ipykernel 6 installed in order to support debugging. Clicking the button will start a debugging session and will allow you to set and hit breakpoints.", "scope": "application" }, + "jupyter.showVariableViewWhenDebugging": { + "type": "boolean", + "default": true, + "description": "Bring up the Variable View when starting a Run by Line session.", + "scope": "application" + }, "jupyter.logging.level": { "type": "string", "default": "debug", diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 1e366969eb2..6230cbd83e4 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -92,6 +92,8 @@ export class JupyterSettings implements IWatchableJupyterSettings { // Hidden settings not surfaced in package.json public disableZMQSupport: boolean = false; public verboseLogging: boolean = false; + public showVariableViewWhenDebugging: boolean = true; + public variableTooltipFields: IVariableTooltipFields = { python: { Tensor: ['shape', 'dtype', 'device'] diff --git a/src/client/common/types.ts b/src/client/common/types.ts index 3e48cc82b9a..05454137f77 100644 --- a/src/client/common/types.ts +++ b/src/client/common/types.ts @@ -174,6 +174,7 @@ export interface IJupyterSettings { readonly interactiveWindowMode: InteractiveWindowMode; readonly disableZMQSupport: boolean; readonly variableTooltipFields: IVariableTooltipFields; + readonly showVariableViewWhenDebugging: boolean; } export interface IVariableTooltipFields { diff --git a/src/client/debugger/jupyter/debuggingManager.ts b/src/client/debugger/jupyter/debuggingManager.ts index a03a16bbf29..a68cd8bc2f6 100644 --- a/src/client/debugger/jupyter/debuggingManager.ts +++ b/src/client/debugger/jupyter/debuggingManager.ts @@ -20,7 +20,7 @@ import { } from 'vscode'; import * as path from 'path'; import { IKernel, IKernelProvider } from '../../datascience/jupyter/kernels/types'; -import { IDisposable, Product, ProductInstallStatus } from '../../common/types'; +import { IConfigurationService, IDisposable, Product, ProductInstallStatus } from '../../common/types'; import { IKernelDebugAdapterConfig, KernelDebugAdapter, KernelDebugMode } from './kernelDebugAdapter'; import { INotebookProvider } from '../../datascience/types'; import { IExtensionSingleActivationService } from '../../activation/types'; @@ -97,7 +97,8 @@ export class DebuggingManager implements IExtensionSingleActivationService, IDeb @inject(IApplicationShell) private readonly appShell: IApplicationShell, @inject(IVSCodeNotebook) private readonly vscNotebook: IVSCodeNotebook, @inject(IFileSystem) private fs: IFileSystem, - @inject(IPythonInstaller) private pythonInstaller: IPythonInstaller + @inject(IPythonInstaller) private pythonInstaller: IPythonInstaller, + @inject(IConfigurationService) private settings: IConfigurationService ) { this.debuggingInProgress = new ContextKey(EditorContexts.DebuggingInProgress, this.commandManager); this.runByLineInProgress = new ContextKey(EditorContexts.RunByLineInProgress, this.commandManager); @@ -147,7 +148,8 @@ export class DebuggingManager implements IExtensionSingleActivationService, IDeb notebook.session, this.commandManager, this.fs, - kernel + kernel, + this.settings ); this.disposables.push( adapter.onDidSendMessage((msg: DebugProtocolMessage) => { diff --git a/src/client/debugger/jupyter/kernelDebugAdapter.ts b/src/client/debugger/jupyter/kernelDebugAdapter.ts index 4618e7965c6..d3a8190d658 100644 --- a/src/client/debugger/jupyter/kernelDebugAdapter.ts +++ b/src/client/debugger/jupyter/kernelDebugAdapter.ts @@ -27,7 +27,7 @@ import { ICommandManager } from '../../common/application/types'; import { traceError, traceVerbose } from '../../common/logger'; import { IFileSystem } from '../../common/platform/types'; import { IKernelDebugAdapter } from '../types'; -import { IDisposable } from '../../common/types'; +import { IConfigurationService, IDisposable } from '../../common/types'; import { Commands, Identifiers } from '../../datascience/constants'; import { IKernel } from '../../datascience/jupyter/kernels/types'; import { sendTelemetryEvent } from '../../telemetry'; @@ -95,7 +95,8 @@ export class KernelDebugAdapter implements DebugAdapter, IKernelDebugAdapter, ID private readonly jupyterSession: IJupyterSession, private commandManager: ICommandManager, private fs: IFileSystem, - private readonly kernel: IKernel | undefined + private readonly kernel: IKernel | undefined, + private settings: IConfigurationService ) { void this.dumpAllCells(); @@ -506,7 +507,10 @@ export class KernelDebugAdapter implements DebugAdapter, IKernelDebugAdapter, ID this.sendRequestToJupyterSession(message); // Open variable view - await this.commandManager.executeCommand(Commands.OpenVariableView); + const settings = this.settings.getSettings(); + if (settings.showVariableViewWhenDebugging) { + await this.commandManager.executeCommand(Commands.OpenVariableView); + } } // Run cell