Skip to content

Commit

Permalink
Implement a command to directly set current time cursor.
Browse files Browse the repository at this point in the history
  • Loading branch information
whitequark committed Oct 9, 2024
1 parent 4ea4944 commit a3c8178
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
9 changes: 9 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -219,6 +224,10 @@
{
"command": "rtlDebugger.stepBackward",
"when": "rtlDebugger.sessionStatus == running"
},
{
"command": "rtlDebugger.goToTime",
"when": "rtlDebugger.sessionStatus == running"
}
],
"view/title": [
Expand Down
21 changes: 15 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 })));
Expand Down

0 comments on commit a3c8178

Please sign in to comment.