This repository has been archived by the owner on Jan 26, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 43
Connect Breakpoints widget with NoteBook #36
Merged
Merged
Changes from 42 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
c5b8d24
some changes
KsavinN 833b2cc
add setting breakpoint in UI
KsavinN e60f900
add notebooktracker to breakpoint wideget
KsavinN e6bd0dc
Merge branch 'notebook_lines' into debugger-ui
KsavinN b3e1fa7
debug for test
KsavinN 5ad3971
add method for update breakpoints after changedLines in Notebook
KsavinN 484108a
develope toogle remove all breakpoints
KsavinN ec77927
Merge branch 'notebook_lines' into debugger-ui
KsavinN 2b0ce1d
changes
KsavinN c37f31c
refactor , suggest by Jeremy
KsavinN 01aa541
rename INoteTracker variable
KsavinN 8752e6f
Merge pull request #8 from jupyterlab/master
KsavinN 061feff
add DebugerNotebookTracker
KsavinN 2d676fa
Merge branch 'master' into session
KsavinN 7dd3752
add breakpointservice
KsavinN 47d0bb3
add service instance
KsavinN d303fcd
remove breakpoints
KsavinN 7da863f
change breakpoints UI during new lines
KsavinN b7551a1
Merge branch 'session' into debugger-ui
KsavinN 743347f
debug forr tests
KsavinN 25b1dc8
new method for redner line
KsavinN a3995cb
add cellManager
KsavinN 681a7d8
Merge branch 'session' into debugger-ui
KsavinN 7f50def
add and debeug consoletracker plugin
KsavinN 951a239
debug consoleTracker
KsavinN c24b512
Merge branch 'session' into debugger-ui
KsavinN fe547a4
check type of kernel and set breakpoints
KsavinN a0bdb64
Merge branch 'session' into debugger-ui
KsavinN fdd97c2
Rename/reorganize some paths.
afshin 6fcd20f
BROKEN - just for comments
afshin 6e63811
Merge pull request #9 from afshin/debugger-ui
KsavinN a053c95
refactoring, still work in progress
KsavinN c8c3a85
Export debugger sidebar.
afshin a2d10a6
next refactor
KsavinN e6c6fa9
Merge branch 'debugger-ui' of https://github.com/afshin/debugger into…
KsavinN 933fade
delete breakpointService , set sidebar in to model of Debuger
KsavinN 0297d8d
add Tracker for handlers between console/notebook
KsavinN 2915521
fix line numbers for breakpoints
KsavinN 85d59d9
fix line numbers for breakpoints
KsavinN f0f1186
Merge branch 'debugger-ui' of github.com:KsavinN/debugger into debugg…
KsavinN 28bdc70
fix edge cases
KsavinN 9355956
Add sessionChanged signal.
afshin 1baa7f4
set session only in debugger model
KsavinN d7071cc
set session only in debugger model
KsavinN 79cbf93
Merge branch 'debugger-ui' of github.com:KsavinN/debugger into debugg…
KsavinN 6cd90a5
add debugger widget to main
KsavinN File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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 | ||||
---|---|---|---|---|---|---|
|
@@ -6,13 +6,15 @@ import { Toolbar, ToolbarButton } from '@jupyterlab/apputils'; | |||||
import { Widget, Panel, PanelLayout } from '@phosphor/widgets'; | ||||||
import { DebugProtocol } from 'vscode-debugprotocol'; | ||||||
import { Body } from './body'; | ||||||
import { Signal, ISignal } from '@phosphor/signaling'; | ||||||
import { Signal } from '@phosphor/signaling'; | ||||||
import { LineInfo } from '../handlers/cell'; | ||||||
|
||||||
// import { BreakpointsService } from '../breakpointsService'; | ||||||
|
||||||
export class Breakpoints extends Panel { | ||||||
constructor(options: Breakpoints.IOptions = {}) { | ||||||
constructor(options: Breakpoints.IOptions) { | ||||||
super(); | ||||||
|
||||||
this.model = new Breakpoints.IModel(MOCK_BREAKPOINTS); | ||||||
this.model = new Breakpoints.Model([]); | ||||||
this.addClass('jp-DebuggerBreakpoints'); | ||||||
this.title.label = 'Breakpoints'; | ||||||
|
||||||
|
@@ -42,7 +44,7 @@ export class Breakpoints extends Panel { | |||||
new ToolbarButton({ | ||||||
iconClassName: 'jp-CloseAllIcon', | ||||||
onClick: () => { | ||||||
this.model.breakpoints = []; | ||||||
this.model.clearSelectedBreakpoints(); | ||||||
}, | ||||||
tooltip: 'Remove All Breakpoints' | ||||||
}) | ||||||
|
@@ -51,7 +53,7 @@ export class Breakpoints extends Panel { | |||||
|
||||||
private isAllActive = true; | ||||||
readonly body: Widget; | ||||||
readonly model: Breakpoints.IModel; | ||||||
readonly model: Breakpoints.Model; | ||||||
} | ||||||
|
||||||
class BreakpointsHeader extends Widget { | ||||||
|
@@ -75,44 +77,94 @@ export namespace Breakpoints { | |||||
active: boolean; | ||||||
} | ||||||
|
||||||
/** | ||||||
* The breakpoints UI model. | ||||||
*/ | ||||||
export interface IModel {} | ||||||
|
||||||
export class IModel implements IModel { | ||||||
export class Model { | ||||||
constructor(model: IBreakpoint[]) { | ||||||
this._state = model; | ||||||
} | ||||||
|
||||||
get breakpointsChanged(): ISignal<this, IBreakpoint[]> { | ||||||
return this._breakpointsChanged; | ||||||
this._breakpoints = model; | ||||||
} | ||||||
|
||||||
get breakpoints(): IBreakpoint[] { | ||||||
return this._state; | ||||||
return this._breakpoints; | ||||||
} | ||||||
|
||||||
get breakpointChanged(): ISignal<this, IBreakpoint> { | ||||||
get breakpointChanged(): Signal<this, IBreakpoint> { | ||||||
return this._breakpointChanged; | ||||||
} | ||||||
|
||||||
set breakpoints(breakpoints: IBreakpoint[]) { | ||||||
this._state = breakpoints; | ||||||
this._breakpointsChanged.emit(this._state); | ||||||
this._breakpoints = [...breakpoints]; | ||||||
this.breakpointsChanged.emit(this._breakpoints); | ||||||
} | ||||||
|
||||||
set breakpoint(breakpoint: IBreakpoint) { | ||||||
const index = this._state.findIndex(ele => ele.id === breakpoint.id); | ||||||
const index = this._breakpoints.findIndex( | ||||||
ele => ele.line === breakpoint.line | ||||||
); | ||||||
if (index !== -1) { | ||||||
this._state[index] = breakpoint; | ||||||
this._breakpoints[index] = breakpoint; | ||||||
this._breakpointChanged.emit(breakpoint); | ||||||
} else { | ||||||
this.breakpoints = [...this.breakpoints, breakpoint]; | ||||||
} | ||||||
} | ||||||
|
||||||
addBreakpoint(session: string, type: string, lineInfo: LineInfo) { | ||||||
const breakpoint: Breakpoints.IBreakpoint = { | ||||||
line: lineInfo.line + 1, | ||||||
active: true, | ||||||
verified: true, | ||||||
source: { | ||||||
name: session | ||||||
} | ||||||
}; | ||||||
this.breakpoints = [...this._breakpoints, breakpoint]; | ||||||
} | ||||||
|
||||||
set type(newType: SessionTypes) { | ||||||
if (newType === this.selectedType) { | ||||||
return; | ||||||
} | ||||||
this.state[this.selectedType] = this.breakpoints; | ||||||
this.selectedType = newType; | ||||||
this.breakpoints = this.state[newType]; | ||||||
} | ||||||
|
||||||
removeBreakpoint(lineInfo: any) { | ||||||
const breakpoints = this.breakpoints.filter( | ||||||
ele => ele.line !== lineInfo.line + 1 | ||||||
); | ||||||
this.breakpoints = breakpoints; | ||||||
} | ||||||
|
||||||
clearSelectedBreakpoints() { | ||||||
this.breakpoints = []; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same question as above |
||||||
this.clearedBreakpoints.emit(this.selectedType); | ||||||
} | ||||||
|
||||||
private _state: IBreakpoint[]; | ||||||
private _breakpointsChanged = new Signal<this, IBreakpoint[]>(this); | ||||||
changeLines(linesInfo: LineInfo[]) { | ||||||
if (!linesInfo && this.breakpoints.length === 0) { | ||||||
return; | ||||||
} | ||||||
if (linesInfo.length === 0) { | ||||||
this.breakpoints = []; | ||||||
} else { | ||||||
const breakpoint = { ...this.breakpoints[0] }; | ||||||
var breakpoints: Breakpoints.IBreakpoint[] = []; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
linesInfo.forEach(ele => { | ||||||
breakpoints.push({ ...breakpoint, line: ele.line + 1 }); | ||||||
}); | ||||||
this.breakpoints = [...breakpoints]; | ||||||
} | ||||||
} | ||||||
|
||||||
private _breakpoints: IBreakpoint[]; | ||||||
breakpointsChanged = new Signal<this, IBreakpoint[]>(this); | ||||||
clearedBreakpoints = new Signal<this, SessionTypes | null>(this); | ||||||
private selectedType: SessionTypes; | ||||||
private _breakpointChanged = new Signal<this, IBreakpoint>(this); | ||||||
private state = { | ||||||
console: [] as Breakpoints.IBreakpoint[], | ||||||
notebook: [] as Breakpoints.IBreakpoint[] | ||||||
}; | ||||||
} | ||||||
|
||||||
/** | ||||||
|
@@ -121,23 +173,4 @@ export namespace Breakpoints { | |||||
export interface IOptions extends Panel.IOptions {} | ||||||
} | ||||||
|
||||||
const MOCK_BREAKPOINTS = [ | ||||||
{ | ||||||
id: 0, | ||||||
active: true, | ||||||
verified: true, | ||||||
source: { | ||||||
name: 'untitled.py' | ||||||
}, | ||||||
line: 6 | ||||||
}, | ||||||
{ | ||||||
id: 1, | ||||||
verified: true, | ||||||
active: false, | ||||||
source: { | ||||||
name: 'untitled.py' | ||||||
}, | ||||||
line: 7 | ||||||
} | ||||||
]; | ||||||
export type SessionTypes = 'console' | 'notebook'; |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go to
devDependencies