Skip to content

Commit a3c8178

Browse files
committed
Implement a command to directly set current time cursor.
1 parent 4ea4944 commit a3c8178

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

package.json

+9
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,11 @@
128128
"title": "Step Backward",
129129
"icon": "$(debug-step-back)"
130130
},
131+
{
132+
"command": "rtlDebugger.goToTime",
133+
"category": "RTL Debugger",
134+
"title": "Go to Time..."
135+
},
131136
{
132137
"command": "rtlDebugger.setRadix.2",
133138
"category": "RTL Debugger",
@@ -219,6 +224,10 @@
219224
{
220225
"command": "rtlDebugger.stepBackward",
221226
"when": "rtlDebugger.sessionStatus == running"
227+
},
228+
{
229+
"command": "rtlDebugger.goToTime",
230+
"when": "rtlDebugger.sessionStatus == running"
222231
}
223232
],
224233
"view/title": [

src/extension.ts

+15-6
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,26 @@ export function activate(context: vscode.ExtensionContext) {
3939
rtlDebugger.session!.runSimulation();
4040
}
4141
}));
42-
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.runSimulationUntil', () => {
43-
inputTime({ prompt: 'Enter the requested simulation time.' }).then((untilTime) => {
44-
if (untilTime !== undefined) {
45-
rtlDebugger.session!.runSimulation({ untilTime });
46-
}
47-
});
42+
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.runSimulationUntil', async () => {
43+
const untilTime = await inputTime({ prompt: 'Enter the time to simulate until.' });
44+
if (untilTime !== undefined) {
45+
rtlDebugger.session!.runSimulation({ untilTime });
46+
}
4847
}));
4948
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.stepBackward', () =>
5049
rtlDebugger.session!.stepBackward()));
5150
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.stepForward', () =>
5251
rtlDebugger.session!.stepForward()));
52+
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.goToTime', async () => {
53+
const goToTime = await inputTime({ prompt: 'Enter the time to examine the state at.' });
54+
if (goToTime !== undefined) {
55+
if (rtlDebugger.session!.simulationStatus.latestTime.lessThan(goToTime)) {
56+
vscode.window.showErrorMessage(`The simulation has not advanced to ${goToTime} yet.`);
57+
} else {
58+
rtlDebugger.session!.timeCursor = goToTime;
59+
}
60+
}
61+
}));
5362

5463
context.subscriptions.push(vscode.commands.registerCommand('rtlDebugger.setRadix.2', (treeItem) =>
5564
globalVariableOptions.update(treeItem.designation.variable.cxxrtlIdentifier, { radix: 2 })));

0 commit comments

Comments
 (0)