Skip to content

Commit

Permalink
add setting for bringing up the variable view
Browse files Browse the repository at this point in the history
  • Loading branch information
David Kutugata committed Aug 26, 2021
1 parent c2b6335 commit 302b645
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions src/client/common/configSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down
1 change: 1 addition & 0 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ export interface IJupyterSettings {
readonly interactiveWindowMode: InteractiveWindowMode;
readonly disableZMQSupport: boolean;
readonly variableTooltipFields: IVariableTooltipFields;
readonly showVariableViewWhenDebugging: boolean;
}

export interface IVariableTooltipFields {
Expand Down
8 changes: 5 additions & 3 deletions src/client/debugger/jupyter/debuggingManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) => {
Expand Down
10 changes: 7 additions & 3 deletions src/client/debugger/jupyter/kernelDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 302b645

Please sign in to comment.