瀏覽代碼

add cleanupHigligth method

Borys Palka 5 年之前
父節點
當前提交
a9450ce856
共有 2 個文件被更改,包括 19 次插入6 次删除
  1. 14 6
      src/handlers/cell.ts
  2. 5 0
      src/service.ts

+ 14 - 6
src/handlers/cell.ts

@@ -43,7 +43,20 @@ export class CellManager implements IDisposable {
   private _activeCell: CodeCell;
   isDisposed: boolean;
 
-  showCurrentLine(lineNumber: number) {
+  private showCurrentLine(lineNumber: number) {
+    if (this.activeCell) {
+      const editor = this.activeCell.editor as CodeMirrorEditor;
+      this.cleanupHighlight();
+      editor.editor.addLineClass(
+        lineNumber - 1,
+        'wrap',
+        'jp-breakpoint-line-highlight'
+      );
+    }
+  }
+
+  // will be used addtioanly when dubber Stop
+  private cleanupHighlight() {
     if (this.activeCell) {
       const editor = this.activeCell.editor as CodeMirrorEditor;
       editor.doc.eachLine(line => {
@@ -53,11 +66,6 @@ export class CellManager implements IDisposable {
           'jp-breakpoint-line-highlight'
         );
       });
-      editor.editor.addLineClass(
-        lineNumber - 1,
-        'wrap',
-        'jp-breakpoint-line-highlight'
-      );
     }
   }
 

+ 5 - 0
src/service.ts

@@ -14,6 +14,11 @@ export class DebugService {
   constructor(session: DebugSession | null, debuggerModel: Debugger.Model) {
     this.session = session;
     this._model = debuggerModel;
+    this.session.eventMessage.connect(
+      (sender: DebugSession, event: IDebugger.ISession.Event) => {
+        console.log({ event });
+      }
+    );
   }
 
   private _session: DebugSession;