forked from microsoft/pxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebuggerToolbox.tsx
More file actions
51 lines (45 loc) · 1.73 KB
/
debuggerToolbox.tsx
File metadata and controls
51 lines (45 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import * as React from "react";
import { DebuggerCallStack } from "./debuggerCallStack";
import { DebuggerVariables } from "./debuggerVariables";
import { DebuggerToolbar } from "./debuggerToolbar";
export interface DebuggerToolboxProps extends pxt.editor.ISettingsProps {
apis: pxt.Map<pxtc.SymbolInfo>;
showCallStack?: boolean;
openLocation?: (breakpoint: number, frameIndex: number) => void;
}
export interface DebuggerToolboxState {
sequence: number;
lastBreakpoint?: pxsim.DebuggerBreakpointMessage;
currentFrame?: number;
varFilters?: string[]
}
export class DebuggerToolbox extends React.Component<DebuggerToolboxProps, DebuggerToolboxState> {
constructor(props: DebuggerToolboxProps) {
super(props);
this.state = {
sequence: 0,
currentFrame: 0
};
}
setBreakpoint(bp: pxsim.DebuggerBreakpointMessage, varFilters?: string[]) {
this.setState({
lastBreakpoint: bp,
currentFrame: 0,
sequence: this.state.sequence + 1,
varFilters: varFilters || this.state.varFilters
});
}
render() {
return <div>
<DebuggerToolbar parent={this.props.parent} />
<DebuggerVariables
apis={this.props.apis}
breakpoint={this.state.lastBreakpoint}
filters={this.state.varFilters}
activeFrame={this.state.currentFrame}
sequence={this.state.sequence} />
{ this.props.showCallStack &&
<DebuggerCallStack openLocation={this.props.openLocation} activeFrame={this.state.currentFrame} stackframes={this.state.lastBreakpoint ? this.state.lastBreakpoint.stackframes : []} /> }
</div>
}
}