diff --git a/package.json b/package.json index ad43ffd..310cbaa 100644 --- a/package.json +++ b/package.json @@ -128,6 +128,11 @@ "title": "Step Backward", "icon": "$(debug-step-back)" }, + { + "command": "rtlDebugger.goToTime", + "category": "RTL Debugger", + "title": "Go to Time..." + }, { "command": "rtlDebugger.setRadix.2", "category": "RTL Debugger", @@ -219,6 +224,10 @@ { "command": "rtlDebugger.stepBackward", "when": "rtlDebugger.sessionStatus == running" + }, + { + "command": "rtlDebugger.goToTime", + "when": "rtlDebugger.sessionStatus == running" } ], "view/title": [ diff --git a/src/extension.ts b/src/extension.ts index 7f60ffd..e2cec30 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -39,17 +39,26 @@ export function activate(context: vscode.ExtensionContext) { rtlDebugger.session!.runSimulation(); } })); - context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.runSimulationUntil', () => { - inputTime({ prompt: 'Enter the requested simulation time.' }).then((untilTime) => { - if (untilTime !== undefined) { - rtlDebugger.session!.runSimulation({ untilTime }); - } - }); + context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.runSimulationUntil', async () => { + const untilTime = await inputTime({ prompt: 'Enter the time to simulate until.' }); + if (untilTime !== undefined) { + rtlDebugger.session!.runSimulation({ untilTime }); + } })); context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.stepBackward', () => rtlDebugger.session!.stepBackward())); context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.stepForward', () => rtlDebugger.session!.stepForward())); + context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.goToTime', async () => { + const goToTime = await inputTime({ prompt: 'Enter the time to examine the state at.' }); + if (goToTime !== undefined) { + if (rtlDebugger.session!.simulationStatus.latestTime.lessThan(goToTime)) { + vscode.window.showErrorMessage(`The simulation has not advanced to ${goToTime} yet.`); + } else { + rtlDebugger.session!.timeCursor = goToTime; + } + } + })); context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.setRadix.2', (treeItem) => globalVariableOptions.update(treeItem.designation.variable.cxxrtlIdentifier, { radix: 2 })));