| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1 @@ | |||
| 1 | + Add debug command code lenses when in debug mode | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -351,6 +351,26 @@ | |||
| 351 | 351 | "title": "%python.command.python.datascience.runcurrentcell.title%", | |
| 352 | 352 | "category": "Python" | |
| 353 | 353 | }, | |
| 354 | + { | ||
| 355 | + "command": "python.datascience.debugcell", | ||
| 356 | + "title": "%python.command.python.datascience.debugcell.title%", | ||
| 357 | + "category": "Python" | ||
| 358 | + }, | ||
| 359 | + { | ||
| 360 | + "command": "python.datascience.debugstepover", | ||
| 361 | + "title": "%python.command.python.datascience.debugstepover.title%", | ||
| 362 | + "category": "Python" | ||
| 363 | + }, | ||
| 364 | + { | ||
| 365 | + "command": "python.datascience.debugstop", | ||
| 366 | + "title": "%python.command.python.datascience.debugstop.title%", | ||
| 367 | + "category": "Python" | ||
| 368 | + }, | ||
| 369 | + { | ||
| 370 | + "command": "python.datascience.debugcontinue", | ||
| 371 | + "title": "%python.command.python.datascience.debugcontinue.title%", | ||
| 372 | + "category": "Python" | ||
| 373 | + }, | ||
| 354 | 374 | { | |
| 355 | 375 | "command": "python.datascience.runcurrentcelladvance", | |
| 356 | 376 | "title": "%python.command.python.datascience.runcurrentcelladvance.title%", | |
@@ -1430,6 +1450,12 @@ | |||
| 1430 | 1450 | "description": "Set of commands to put as code lens above a cell. Defaults to 'python.datascience.runcell, python.datascience.runallcellsabove, python.datascience.debugcell'", | |
| 1431 | 1451 | "scope": "resource" | |
| 1432 | 1452 | }, | |
| 1453 | + "python.dataScience.debugCodeLenses": { | ||
| 1454 | + "type": "string", | ||
| 1455 | + "default": "python.datascience.debugcontinue, python.datascience.debugstop, python.datascience.debugstepover", | ||
| 1456 | + "description": "Set of debug commands to put as code lens above a cell while debugging.", | ||
| 1457 | + "scope": "resource" | ||
| 1458 | + }, | ||
| 1433 | 1459 | "python.dataScience.ptvsdDistPath": { | |
| 1434 | 1460 | "type": "string", | |
| 1435 | 1461 | "default": "", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -39,6 +39,9 @@ | |||
| 39 | 39 | "python.command.python.datascience.runcurrentcellandallbelow.palette.title": "Run Current Cell and Below", | |
| 40 | 40 | "python.command.python.datascience.debugcurrentcell.palette.title": "Debug Current Cell", | |
| 41 | 41 | "python.command.python.datascience.debugcell.title": "Debug Cell", | |
| 42 | + "python.command.python.datascience.debugstepover.title": "Step Over", | ||
| 43 | + "python.command.python.datascience.debugcontinue.title": "Continue", | ||
| 44 | + "python.command.python.datascience.debugstop.title": "Stop", | ||
| 42 | 45 | "python.command.python.datascience.runtoline.title": "Run To Line in Python Interactive Window", | |
| 43 | 46 | "python.command.python.datascience.runfromline.title": "Run From Line in Python Interactive Window", | |
| 44 | 47 | "python.command.python.datascience.runcurrentcell.title": "Run Current Cell", | |
@@ -305,6 +308,9 @@ | |||
| 305 | 308 | "DataScience.jupyterDataRateExceeded": "Cannot view variable because data rate exceeded. Please restart your server with a higher data rate limit. For example, --NotebookApp.iopub_data_rate_limit=10000000000.0", | |
| 306 | 309 | "DataScience.addCellBelowCommandTitle": "Add cell", | |
| 307 | 310 | "DataScience.debugCellCommandTitle": "Debug cell", | |
| 311 | + "DataScience.debugStepOverCommandTitle": "Step over", | ||
| 312 | + "DataScience.debugContinueCommandTitle": "Continue", | ||
| 313 | + "DataScience.debugStopCommandTitle": "Stop", | ||
| 308 | 314 | "DataScience.runCurrentCellAndAddBelow": "Run current and add cell below", | |
| 309 | 315 | "DataScience.variableExplorerDisabledDuringDebugging": "Please see the Debug Side Bar's VARIABLES section.", | |
| 310 | 316 | "DataScience.jupyterDebuggerNotInstalledError": "Pip module ptvsd is required for debugging cells. You will need to install it to debug cells.", | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -25,6 +25,8 @@ interface ICommandNameWithoutArgumentTypeMapping { | |||
| 25 | 25 | [Commands.Set_ShebangInterpreter]: []; | |
| 26 | 26 | [Commands.Run_Linter]: []; | |
| 27 | 27 | [Commands.Enable_Linter]: []; | |
| 28 | + ['workbench.action.debug.continue']: []; | ||
| 29 | + ['workbench.action.debug.stepOver']: []; | ||
| 28 | 30 | ['workbench.action.debug.stop']: []; | |
| 29 | 31 | ['workbench.action.reloadWindow']: []; | |
| 30 | 32 | ['editor.action.formatDocument']: []; | |
@@ -115,6 +117,9 @@ export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgu | |||
| 115 | 117 | [DSCommands.RunFileInInteractiveWindows]: [string]; | |
| 116 | 118 | [DSCommands.DebugFileInInteractiveWindows]: [string]; | |
| 117 | 119 | [DSCommands.DebugCell]: [string, number, number, number, number]; | |
| 120 | + [DSCommands.DebugStepOver]: []; | ||
| 121 | + [DSCommands.DebugStop]: []; | ||
| 122 | + [DSCommands.DebugContinue]: []; | ||
| 118 | 123 | [DSCommands.RunCurrentCellAndAddBelow]: [string]; | |
| 119 | 124 | [DSCommands.ScrollToCell]: [string, string]; | |
| 120 | 125 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -38,6 +38,10 @@ export class DebugService implements IDebugService { | |||
| 38 | 38 | public registerDebugConfigurationProvider(debugType: string, provider: any): Disposable { | |
| 39 | 39 | return debug.registerDebugConfigurationProvider(debugType, provider); | |
| 40 | 40 | } | |
| 41 | + // tslint:disable-next-line:no-any | ||
| 42 | + public registerDebugAdapterTrackerFactory(debugType: string, provider: any): Disposable { | ||
| 43 | + return debug.registerDebugAdapterTrackerFactory(debugType, provider); | ||
| 44 | + } | ||
| 41 | 45 | public startDebugging(folder: WorkspaceFolder | undefined, nameOrConfiguration: string | DebugConfiguration, parentSession?: DebugSession): Thenable<boolean> { | |
| 42 | 46 | return debug.startDebugging(folder, nameOrConfiguration, parentSession); | |
| 43 | 47 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,6 +7,7 @@ import { | |||
| 7 | 7 | CancellationToken, | |
| 8 | 8 | CompletionItemProvider, | |
| 9 | 9 | ConfigurationChangeEvent, | |
| 10 | + DebugAdapterTrackerFactory, | ||
| 10 | 11 | DebugConfiguration, | |
| 11 | 12 | DebugConfigurationProvider, | |
| 12 | 13 | DebugConsole, | |
@@ -764,6 +765,15 @@ export interface IDebugService { | |||
| 764 | 765 | */ | |
| 765 | 766 | registerDebugConfigurationProvider(debugType: string, provider: DebugConfigurationProvider): Disposable; | |
| 766 | 767 | ||
| 768 | + /** | ||
| 769 | + * Register a debug adapter tracker factory for the given debug type. | ||
| 770 | + * | ||
| 771 | + * @param debugType The debug type for which the factory is registered or '*' for matching all debug types. | ||
| 772 | + * @param factory The [debug adapter tracker factory](#DebugAdapterTrackerFactory) to register. | ||
| 773 | + * @return A [disposable](#Disposable) that unregisters this factory when being disposed. | ||
| 774 | + */ | ||
| 775 | + registerDebugAdapterTrackerFactory(debugType: string, factory: DebugAdapterTrackerFactory): Disposable; | ||
| 776 | + | ||
| 767 | 777 | /** | |
| 768 | 778 | * Start debugging by using either a named launch or named compound configuration, | |
| 769 | 779 | * or by directly passing a [DebugConfiguration](#DebugConfiguration). | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -324,6 +324,7 @@ export interface IDataScienceSettings { | |||
| 324 | 324 | askForKernelRestart?: boolean; | |
| 325 | 325 | enablePlotViewer?: boolean; | |
| 326 | 326 | codeLenses?: string; | |
| 327 | + debugCodeLenses?: string; | ||
| 327 | 328 | ptvsdDistPath?: string; | |
| 328 | 329 | stopOnFirstLineWhileDebugging?: boolean; | |
| 329 | 330 | textOutputLimit?: number; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -229,6 +229,9 @@ export namespace DataScience { | |||
| 229 | 229 | export const jupyterDataRateExceeded = localize('DataScience.jupyterDataRateExceeded', 'Cannot view variable because data rate exceeded. Please restart your server with a higher data rate limit. For example, --NotebookApp.iopub_data_rate_limit=10000000000.0'); | |
| 230 | 230 | export const addCellBelowCommandTitle = localize('DataScience.addCellBelowCommandTitle', 'Add cell'); | |
| 231 | 231 | export const debugCellCommandTitle = localize('DataScience.debugCellCommandTitle', 'Debug cell'); | |
| 232 | + export const debugStepOverCommandTitle = localize('DataScience.debugStepOverCommandTitle', 'Step over'); | ||
| 233 | + export const debugContinueCommandTitle = localize('DataScience.debugContinueCommandTitle', 'Continue'); | ||
| 234 | + export const debugStopCommandTitle = localize('DataScience.debugStopCommandTitle', 'Stop'); | ||
| 232 | 235 | export const runCurrentCellAndAddBelow = localize('DataScience.runCurrentCellAndAddBelow', 'Run current and add cell below'); | |
| 233 | 236 | export const variableExplorerDisabledDuringDebugging = localize('DataScience.variableExplorerDisabledDuringDebugging', 'Please see the Debug Side Bar\'s VARIABLES section.'); | |
| 234 | 237 | export const jupyterDebuggerNotInstalledError = localize('DataScience.jupyterDebuggerNotInstalledError', 'Pip module ptvsd is required for debugging cells. You will need to install it to debug cells.'); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,10 +36,22 @@ export namespace Commands { | |||
| 36 | 36 | export const AddCellBelow = 'python.datascience.addcellbelow'; | |
| 37 | 37 | export const DebugCurrentCellPalette = 'python.datascience.debugcurrentcell.palette'; | |
| 38 | 38 | export const DebugCell = 'python.datascience.debugcell'; | |
| 39 | + export const DebugStepOver = 'python.datascience.debugstepover'; | ||
| 40 | + export const DebugContinue = 'python.datascience.debugcontinue'; | ||
| 41 | + export const DebugStop = 'python.datascience.debugstop'; | ||
| 39 | 42 | export const RunCurrentCellAndAddBelow = 'python.datascience.runcurrentcellandaddbelow'; | |
| 40 | 43 | export const ScrollToCell = 'python.datascience.scrolltocell'; | |
| 41 | 44 | } | |
| 42 | 45 | ||
| 46 | + export namespace CodeLensCommands { | ||
| 47 | + // If not specified in the options this is the default set of commands in our design time code lenses | ||
| 48 | + export const DefaultDesignLenses = [Commands.RunCurrentCell, Commands.RunAllCellsAbove, Commands.DebugCell]; | ||
| 49 | + // If not specified in the options this is the default set of commands in our debug time code lenses | ||
| 50 | + export const DefaultDebuggingLenses = [Commands.DebugContinue, Commands.DebugStop, Commands.DebugStepOver]; | ||
| 51 | + // These are the commands that are allowed at debug time | ||
| 52 | + export const DebuggerCommands = [Commands.DebugContinue, Commands.DebugStop, Commands.DebugStepOver]; | ||
| 53 | + } | ||
| 54 | + | ||
| 43 | 55 | export namespace EditorContexts { | |
| 44 | 56 | export const HasCodeCells = 'python.datascience.hascodecells'; | |
| 45 | 57 | export const DataScienceEnabled = 'python.datascience.featureenabled'; | |
@@ -152,7 +164,10 @@ export enum Telemetry { | |||
| 152 | 164 | PtvsdPromptToInstall = 'DATASCIENCE.PTVSD_PROMPT_TO_INSTALL', | |
| 153 | 165 | PtvsdSuccessfullyInstalled = 'DATASCIENCE.PTVSD_SUCCESSFULLY_INSTALLED', | |
| 154 | 166 | PtvsdInstallFailed = 'DATASCIENCE.PTVSD_INSTALL_FAILED', | |
| 155 | - ScrolledToCell = 'DATASCIENCE.SCROLLED_TO_CELL' | ||
| 167 | + ScrolledToCell = 'DATASCIENCE.SCROLLED_TO_CELL', | ||
| 168 | + DebugStepOver = 'DATASCIENCE.DEBUG_STEP_OVER', | ||
| 169 | + DebugContinue = 'DATASCIENCE.DEBUG_CONTINUE', | ||
| 170 | + DebugStop = 'DATASCIENCE.DEBUG_STOP' | ||
| 156 | 171 | } | |
| 157 | 172 | ||
| 158 | 173 | export namespace HelpLinks { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ import { inject, injectable } from 'inversify'; | |||
| 8 | 8 | import { URL } from 'url'; | |
| 9 | 9 | import * as vscode from 'vscode'; | |
| 10 | 10 | ||
| 11 | - import { IApplicationShell, ICommandManager, IDocumentManager, IWorkspaceService } from '../common/application/types'; | ||
| 11 | + import { IApplicationShell, ICommandManager, IDebugService, IDocumentManager, IWorkspaceService } from '../common/application/types'; | ||
| 12 | 12 | import { PYTHON_ALLFILES, PYTHON_LANGUAGE } from '../common/constants'; | |
| 13 | 13 | import { ContextKey } from '../common/contextKey'; | |
| 14 | 14 | import { traceError } from '../common/logger'; | |
@@ -43,6 +43,7 @@ export class DataScience implements IDataScience { | |||
| 43 | 43 | @inject(IConfigurationService) private configuration: IConfigurationService, | |
| 44 | 44 | @inject(IDocumentManager) private documentManager: IDocumentManager, | |
| 45 | 45 | @inject(IApplicationShell) private appShell: IApplicationShell, | |
| 46 | + @inject(IDebugService) private debugService: IDebugService, | ||
| 46 | 47 | @inject(IWorkspaceService) private workspace: IWorkspaceService | |
| 47 | 48 | ) { | |
| 48 | 49 | this.commandListeners = this.serviceContainer.getAll<IDataScienceCommandListener>(IDataScienceCommandListener); | |
@@ -243,6 +244,36 @@ export class DataScience implements IDataScience { | |||
| 243 | 244 | } | |
| 244 | 245 | } | |
| 245 | 246 | ||
| 247 | + @captureTelemetry(Telemetry.DebugStepOver) | ||
| 248 | + public async debugStepOver(): Promise<void> { | ||
| 249 | + this.dataScienceSurveyBanner.showBanner().ignoreErrors(); | ||
| 250 | + | ||
| 251 | + // Make sure that we are in debug mode | ||
| 252 | + if (this.debugService.activeDebugSession) { | ||
| 253 | + this.commandManager.executeCommand('workbench.action.debug.stepOver'); | ||
| 254 | + } | ||
| 255 | + } | ||
| 256 | + | ||
| 257 | + @captureTelemetry(Telemetry.DebugStop) | ||
| 258 | + public async debugStop(): Promise<void> { | ||
| 259 | + this.dataScienceSurveyBanner.showBanner().ignoreErrors(); | ||
| 260 | + | ||
| 261 | + // Make sure that we are in debug mode | ||
| 262 | + if (this.debugService.activeDebugSession) { | ||
| 263 | + this.commandManager.executeCommand('workbench.action.debug.stop'); | ||
| 264 | + } | ||
| 265 | + } | ||
| 266 | + | ||
| 267 | + @captureTelemetry(Telemetry.DebugContinue) | ||
| 268 | + public async debugContinue(): Promise<void> { | ||
| 269 | + this.dataScienceSurveyBanner.showBanner().ignoreErrors(); | ||
| 270 | + | ||
| 271 | + // Make sure that we are in debug mode | ||
| 272 | + if (this.debugService.activeDebugSession) { | ||
| 273 | + this.commandManager.executeCommand('workbench.action.debug.continue'); | ||
| 274 | + } | ||
| 275 | + } | ||
| 276 | + | ||
| 246 | 277 | @captureTelemetry(Telemetry.SetJupyterURIToLocal) | |
| 247 | 278 | private async setJupyterURIToLocal(): Promise<void> { | |
| 248 | 279 | await this.configuration.updateSetting('dataScience.jupyterServerURI', Settings.JupyterServerLocalLaunch, undefined, vscode.ConfigurationTarget.Workspace); | |
@@ -417,6 +448,12 @@ export class DataScience implements IDataScience { | |||
| 417 | 448 | this.disposableRegistry.push(disposable); | |
| 418 | 449 | disposable = this.commandManager.registerCommand(Commands.DebugCell, this.debugCell, this); | |
| 419 | 450 | this.disposableRegistry.push(disposable); | |
| 451 | + disposable = this.commandManager.registerCommand(Commands.DebugStepOver, this.debugStepOver, this); | ||
| 452 | + this.disposableRegistry.push(disposable); | ||
| 453 | + disposable = this.commandManager.registerCommand(Commands.DebugContinue, this.debugContinue, this); | ||
| 454 | + this.disposableRegistry.push(disposable); | ||
| 455 | + disposable = this.commandManager.registerCommand(Commands.DebugStop, this.debugStop, this); | ||
| 456 | + this.disposableRegistry.push(disposable); | ||
| 420 | 457 | disposable = this.commandManager.registerCommand(Commands.DebugCurrentCellPalette, this.debugCurrentCellFromCursor, this); | |
| 421 | 458 | this.disposableRegistry.push(disposable); | |
| 422 | 459 | this.commandListeners.forEach((listener: IDataScienceCommandListener) => { | |
| Back | FazBrowse Home | New Git URL |
0 commit comments