Skip to content

Commit ad4d4d5

Browse files
committed
[DebugAdapter] Fix up variables to work with Stack's changes
1 parent 9faf2c0 commit ad4d4d5

File tree

1 file changed

+13
-16
lines changed

1 file changed

+13
-16
lines changed

editors/code/src/debugAdapter.ts

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,12 @@ import { outputChannel } from './extension';
2222

2323
interface LogMapping {
2424
srcRef: SourceRef,
25-
variables: Map<string, string>,
26-
stack: Array<Array<SourceRef>>
25+
variables: Array<VariablePair>
26+
}
27+
28+
interface VariablePair {
29+
expr: string,
30+
value: string,
2731
}
2832

2933
interface SourceRef {
@@ -277,7 +281,7 @@ export class DebugSession extends LoggingDebugSession {
277281
'--log', this._launchArgs.log,
278282
'--start', start,
279283
'--end', end]
280-
if (this._launchArgs.log_format !== "") {
284+
if (this._launchArgs.log_format !== undefined && this._launchArgs.log_format !== "") {
281285
l2sArgs.push("-f");
282286
l2sArgs.push(this._launchArgs.log_format);
283287
}
@@ -291,13 +295,6 @@ export class DebugSession extends LoggingDebugSession {
291295
const stack: StackFrame[] = [];
292296
stack.push(currentFrame);
293297

294-
if (this._mapping?.stack.length === 1 && this._mapping?.stack[0].length > 0) {
295-
this._mapping?.stack[0].forEach((srcRef) => {
296-
const frame = this.buildStackFrame(index++, srcRef);
297-
stack.push(frame);
298-
});
299-
}
300-
301298
response.body = {
302299
stackFrames: stack,
303300
totalFrames: stack.length
@@ -364,12 +361,12 @@ export class DebugSession extends LoggingDebugSession {
364361

365362
const v = this._variableHandles.get(args.variablesReference);
366363
if (v === 'locals' && this._mapping !== undefined) {
367-
for (let [key, value] of Object.entries(this._mapping.variables)) {
368-
vs.push({
369-
name: key,
370-
value: value,
371-
variablesReference: 0
372-
});
364+
for (let pair of this._mapping.variables) {
365+
vs.push({
366+
name: pair.expr,
367+
value: pair.value,
368+
variablesReference: 0
369+
});
373370
}
374371
}
375372

0 commit comments

Comments
 (0)