Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
happytomatoe committed Sep 17, 2024
1 parent 0f154c2 commit a44cbcb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
6 changes: 3 additions & 3 deletions web/src/pages/vm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@ const VM = () => {
useEffect(() => {
vmRunner.current = new (class VMTimer extends Timer {
override async tick() {
const {done, lineNumber} = actions.step();
const { done, lineNumber } = actions.step();
console.log("Breakpoints", breakpoints);
if(breakpoints.includes(lineNumber)){
if (breakpoints.includes(lineNumber)) {
return true;
}
return done;
Expand Down Expand Up @@ -417,7 +417,7 @@ function VMStackFrame({
<main>
<p>
Stack:
<code>[{frame.stack.values.join(", ")}]</code>
{/* <code>[{frame.stack.values.join(", ")}]</code> */}
</p>
{frame.usedSegments?.has("local") && (
<p>
Expand Down
14 changes: 7 additions & 7 deletions web/src/shell/Monaco.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const Monaco = ({
dynamicHeight = false,
alwaysRecenter = true,
lineNumberTransform,
setBreakpoints
setBreakpoints,
}: {
value: string;
onChange: Action<string>;
Expand All @@ -106,18 +106,18 @@ export const Monaco = ({
const [instance, setInstace] = useState<MonacoBreakpoint>();
const [b, setB] = useState<boolean>(false);
const bCallback = useCallback((breakpoints: number[]) => {
console.log('breakpointChanged: ', breakpoints);
if(setBreakpoints!==undefined){
console.log("breakpointChanged: ", breakpoints);
if (setBreakpoints !== undefined) {
setBreakpoints(breakpoints);
}
}, []);
useEffect(() => {
if (instance && !b) {
console.log("add callback for breakpoints")
instance.on('breakpointChanged', bCallback)
console.log("add callback for breakpoints");
instance.on("breakpointChanged", bCallback);
setB(true);
}
}, [instance, bCallback])
}, [instance, bCallback]);
const codeTheme = useCallback(() => {
const isDark =
theme === "system"
Expand Down Expand Up @@ -187,7 +187,7 @@ export const Monaco = ({
const onMount: OnMount = useCallback(
(ed, mon) => {
if (instance === undefined) {
setInstace(new MonacoBreakpoint({ editor: ed }))
setInstace(new MonacoBreakpoint({ editor: ed }));
}
monaco.current = mon;
editor.current = ed;
Expand Down
5 changes: 2 additions & 3 deletions web/src/shell/editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export const Editor = ({
dynamicHeight = false,
alwaysRecenter = true,
lineNumberTransform,
setBreakpoints
setBreakpoints,
}: {
className?: string;
style?: CSSProperties;
Expand All @@ -94,7 +94,7 @@ export const Editor = ({
dynamicHeight?: boolean;
alwaysRecenter?: boolean;
lineNumberTransform?: (n: number) => string;
setBreakpoints?: (n:number[]) => void
setBreakpoints?: (n: number[]) => void;
}) => {
const { monaco } = useContext(AppContext);

Expand All @@ -119,7 +119,6 @@ export const Editor = ({
alwaysRecenter={alwaysRecenter}
lineNumberTransform={lineNumberTransform}
setBreakpoints={setBreakpoints}

/>
</Suspense>
) : (
Expand Down

0 comments on commit a44cbcb

Please sign in to comment.