This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #316 from jtpio/split-files
Split breakpoints, variables, sources and callstack into different files
- Loading branch information
Showing
27 changed files
with
1,085 additions
and
684 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { Toolbar } from '@jupyterlab/apputils'; | ||
|
||
import { PanelLayout, Widget } from '@phosphor/widgets'; | ||
|
||
/** | ||
* The header for a Breakpoints Panel. | ||
*/ | ||
export class BreakpointsHeader extends Widget { | ||
/** | ||
* Instantiate a new BreakpointsHeader. | ||
*/ | ||
constructor() { | ||
super({ node: document.createElement('header') }); | ||
|
||
const title = new Widget({ node: document.createElement('h2') }); | ||
title.node.textContent = 'Breakpoints'; | ||
|
||
const layout = new PanelLayout(); | ||
layout.addWidget(title); | ||
layout.addWidget(this.toolbar); | ||
this.layout = layout; | ||
} | ||
|
||
/** | ||
* The toolbar for the breakpoints header. | ||
*/ | ||
readonly toolbar = new Toolbar(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// Copyright (c) Jupyter Development Team. | ||
// Distributed under the terms of the Modified BSD License. | ||
|
||
import { IDisposable } from '@phosphor/disposable'; | ||
|
||
import { ISignal, Signal } from '@phosphor/signaling'; | ||
|
||
import { IDebugger } from '../tokens'; | ||
|
||
/** | ||
* A model for a list of breakpoints. | ||
*/ | ||
export class BreakpointsModel implements IDisposable { | ||
/** | ||
* Whether the model is disposed. | ||
*/ | ||
get isDisposed(): boolean { | ||
return this._isDisposed; | ||
} | ||
|
||
/** | ||
* Signal emitted when the model changes. | ||
*/ | ||
get changed(): ISignal<this, IDebugger.IBreakpoint[]> { | ||
return this._changed; | ||
} | ||
|
||
/** | ||
* Signal emitted when the breakpoints are restored. | ||
*/ | ||
get restored(): Signal<this, void> { | ||
return this._restored; | ||
} | ||
|
||
/** | ||
* Signal emitted when a breakpoint is clicked. | ||
*/ | ||
get clicked(): Signal<this, IDebugger.IBreakpoint> { | ||
return this._clicked; | ||
} | ||
|
||
/** | ||
* Get all the breakpoints. | ||
*/ | ||
get breakpoints(): Map<string, IDebugger.IBreakpoint[]> { | ||
return this._breakpoints; | ||
} | ||
|
||
/** | ||
* Dispose the model. | ||
*/ | ||
dispose(): void { | ||
if (this._isDisposed) { | ||
return; | ||
} | ||
this._isDisposed = true; | ||
Signal.clearData(this); | ||
} | ||
|
||
/** | ||
* Set the breakpoints for a given id (path). | ||
* @param id The code id (path). | ||
* @param breakpoints The list of breakpoints. | ||
*/ | ||
setBreakpoints(id: string, breakpoints: IDebugger.IBreakpoint[]) { | ||
this._breakpoints.set(id, breakpoints); | ||
this._changed.emit(breakpoints); | ||
} | ||
|
||
/** | ||
* Get the breakpoints for a given id (path). | ||
* @param id The code id (path). | ||
*/ | ||
getBreakpoints(id: string): IDebugger.IBreakpoint[] { | ||
return this._breakpoints.get(id) ?? []; | ||
} | ||
|
||
/** | ||
* Restore a map of breakpoints. | ||
* @param breakpoints The map of breakpoints | ||
*/ | ||
restoreBreakpoints(breakpoints: Map<string, IDebugger.IBreakpoint[]>) { | ||
this._breakpoints = breakpoints; | ||
this._restored.emit(); | ||
} | ||
|
||
private _isDisposed = false; | ||
private _breakpoints = new Map<string, IDebugger.IBreakpoint[]>(); | ||
private _changed = new Signal<this, IDebugger.IBreakpoint[]>(this); | ||
private _restored = new Signal<this, void>(this); | ||
private _clicked = new Signal<this, IDebugger.IBreakpoint>(this); | ||
} |
Oops, something went wrong.