Browse Source

Map debug actions to callstack buttons

Jeremy Tuloup 5 years ago
parent
commit
716f925e2f
2 changed files with 22 additions and 6 deletions
  1. 21 5
      src/callstack/index.ts
  2. 1 1
      src/debugger.ts

+ 21 - 5
src/callstack/index.ts

@@ -6,13 +6,16 @@ import { Toolbar, ToolbarButton } from '@jupyterlab/apputils';
 import { ISignal, Signal } from '@phosphor/signaling';
 import { Panel, PanelLayout, Widget } from '@phosphor/widgets';
 import { DebugProtocol } from 'vscode-debugprotocol';
+import { IDebugger } from '../tokens';
 import { Body } from './body';
 
 export class Callstack extends Panel {
   constructor(options: Callstack.IOptions) {
     super();
 
-    this.model = options.model;
+    const { service, model } = options;
+
+    this.model = model;
     this.addClass('jp-DebuggerCallstack');
     this.title.label = 'Callstack';
 
@@ -27,7 +30,10 @@ export class Callstack extends Panel {
       new ToolbarButton({
         iconClassName: 'jp-RunIcon',
         onClick: () => {
-          console.log('`run` was clicked');
+          if (!service.isThreadStopped()) {
+            return;
+          }
+          void service.continue();
         },
         tooltip: 'Continue'
       })
@@ -47,7 +53,10 @@ export class Callstack extends Panel {
       new ToolbarButton({
         iconClassName: 'jp-StepOverIcon',
         onClick: () => {
-          console.log('`step over` was clicked');
+          if (!service.isThreadStopped()) {
+            return;
+          }
+          void service.next();
         },
         tooltip: 'Step Over'
       })
@@ -57,7 +66,10 @@ export class Callstack extends Panel {
       new ToolbarButton({
         iconClassName: 'jp-StepInIcon',
         onClick: () => {
-          console.log('`step in` was clicked');
+          if (!service.isThreadStopped()) {
+            return;
+          }
+          void service.stepIn();
         },
         tooltip: 'Step In'
       })
@@ -67,7 +79,10 @@ export class Callstack extends Panel {
       new ToolbarButton({
         iconClassName: 'jp-StepOutIcon',
         onClick: () => {
-          console.log('`step out` was clicked');
+          if (!service.isThreadStopped()) {
+            return;
+          }
+          void service.stepOut();
         },
         tooltip: 'Step Out'
       })
@@ -134,6 +149,7 @@ export namespace Callstack {
   }
 
   export interface IOptions extends Panel.IOptions {
+    service: IDebugger;
     model: Model;
   }
 }

+ 1 - 1
src/debugger.ts

@@ -93,7 +93,7 @@ export namespace Debugger {
 
       const { service, model } = options;
       this.variables = new Variables({ model: model.variablesModel });
-      this.callstack = new Callstack({ model: model.callstackModel });
+      this.callstack = new Callstack({ service, model: model.callstackModel });
       this.breakpoints = new Breakpoints({
         service,
         model: model.breakpointsModel