Skip to content

Commit 8c94314

Browse files
authored
Ensure column number is not 0 in response of stackTrace (#947)
Fixes #946
1 parent 0f39773 commit 8c94314

File tree

3 files changed

+19
-19
lines changed

3 files changed

+19
-19
lines changed

src/client/debugger/Main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ export class PythonDebugger extends LoggingDebugSession {
486486
return new StackFrame(frameId, frame.FunctionName,
487487
new Source(path.basename(frame.FileName), fileName),
488488
this.convertDebuggerLineToClient(frame.LineNo - 1),
489-
0);
489+
1);
490490
}
491491
});
492492
});

src/test/debugger/attach.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ suite('Attach Debugger', () => {
9999
await attachedOutputReceived;
100100

101101
// Add a breakpoint.
102-
const breakpointLocation = { path: fileToDebug, column: 0, line: 16 };
102+
const breakpointLocation = { path: fileToDebug, column: 1, line: 16 };
103103
await debugClient.setBreakpointsRequest({
104104
lines: [breakpointLocation.line],
105105
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],

src/test/debugger/misc.test.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -156,15 +156,15 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
156156
});
157157
test('Should break at print statement (line 3)', async () => {
158158
const launchArgs = buildLauncArgs('sample2.py', false);
159-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
159+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
160160
await debugClient.hitBreakpoint(launchArgs, breakpointLocation);
161161
});
162162
test('Should kill python process when ending debug session', async function () {
163163
if (debuggerType === 'python') {
164164
return this.skip();
165165
}
166166
const launchArgs = buildLauncArgs('sample2.py', false);
167-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
167+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
168168
const processPromise = debugClient.waitForEvent('process') as Promise<DebugProtocol.ProcessEvent>;
169169
await debugClient.hitBreakpoint(launchArgs, breakpointLocation);
170170
const processInfo = await processPromise;
@@ -186,7 +186,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
186186
debugClient.waitForEvent('initialized')
187187
]);
188188

189-
const breakpointLocation = { path: path.join(debugFilesPath, 'forever.py'), column: 0, line: 5 };
189+
const breakpointLocation = { path: path.join(debugFilesPath, 'forever.py'), column: 1, line: 5 };
190190
await debugClient.setBreakpointsRequest({
191191
lines: [breakpointLocation.line],
192192
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column, condition: 'i == 3' }],
@@ -216,7 +216,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
216216
debugClient.waitForEvent('initialized')
217217
]);
218218

219-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
219+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
220220
await debugClient.setBreakpointsRequest({
221221
lines: [breakpointLocation.line],
222222
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -253,7 +253,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
253253
debugClient.waitForEvent('initialized')
254254
]);
255255

256-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
256+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
257257
await debugClient.setBreakpointsRequest({
258258
lines: [breakpointLocation.line],
259259
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -287,7 +287,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
287287
debugClient.waitForEvent('initialized')
288288
]);
289289

290-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
290+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
291291
await debugClient.setBreakpointsRequest({
292292
lines: [breakpointLocation.line],
293293
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -313,7 +313,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
313313
debugClient.waitForEvent('initialized')
314314
]);
315315

316-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
316+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
317317
await debugClient.setBreakpointsRequest({
318318
lines: [breakpointLocation.line],
319319
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -325,15 +325,15 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
325325
await debugClient.assertStoppedLocation('breakpoint', breakpointLocation);
326326

327327
await debugClient.nextRequest({ threadId });
328-
const functionLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 7 };
328+
const functionLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 7 };
329329
await debugClient.assertStoppedLocation('step', functionLocation);
330330

331331
await debugClient.nextRequest({ threadId });
332-
const functionInvocationLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 11 };
332+
const functionInvocationLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 11 };
333333
await debugClient.assertStoppedLocation('step', functionInvocationLocation);
334334

335335
await debugClient.nextRequest({ threadId });
336-
const printLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 13 };
336+
const printLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 13 };
337337
await debugClient.assertStoppedLocation('step', printLocation);
338338
});
339339
test('Test stepin and stepout', async () => {
@@ -345,7 +345,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
345345
debugClient.waitForEvent('initialized')
346346
]);
347347

348-
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 5 };
348+
const breakpointLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 5 };
349349
await debugClient.setBreakpointsRequest({
350350
lines: [breakpointLocation.line],
351351
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -357,22 +357,22 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
357357
const threadId = ((await threadIdPromise) as ThreadEvent).body.threadId;
358358

359359
await debugClient.nextRequest({ threadId });
360-
const functionLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 7 };
360+
const functionLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 7 };
361361
await debugClient.assertStoppedLocation('step', functionLocation);
362362

363363
await debugClient.nextRequest({ threadId });
364-
const functionInvocationLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 11 };
364+
const functionInvocationLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 11 };
365365
await debugClient.assertStoppedLocation('step', functionInvocationLocation);
366366

367367
await debugClient.stepInRequest({ threadId });
368-
const loopPrintLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 8 };
368+
const loopPrintLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 8 };
369369
await debugClient.assertStoppedLocation('step', loopPrintLocation);
370370

371371
await debugClient.stepOutRequest({ threadId });
372372
await debugClient.assertStoppedLocation('step', functionInvocationLocation);
373373

374374
await debugClient.nextRequest({ threadId });
375-
const printLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 0, line: 13 };
375+
const printLocation = { path: path.join(debugFilesPath, 'sample2.py'), column: 1, line: 13 };
376376
await debugClient.assertStoppedLocation('step', printLocation);
377377
});
378378
test('Test pausing', async function () {
@@ -415,7 +415,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
415415
debugClient.waitForEvent('initialized')
416416
]);
417417
const pythonFile = path.join(debugFilesPath, 'multiThread.py');
418-
const breakpointLocation = { path: pythonFile, column: 0, line: 11 };
418+
const breakpointLocation = { path: pythonFile, column: 1, line: 11 };
419419
await debugClient.setBreakpointsRequest({
420420
lines: [breakpointLocation.line],
421421
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],
@@ -438,7 +438,7 @@ const EXPERIMENTAL_DEBUG_ADAPTER = path.join(__dirname, '..', '..', 'client', 'd
438438
debugClient.waitForEvent('initialized')
439439
]);
440440
const pythonFile = path.join(debugFilesPath, 'stackFrame.py');
441-
const breakpointLocation = { path: pythonFile, column: 0, line: 5 };
441+
const breakpointLocation = { path: pythonFile, column: 1, line: 5 };
442442
await debugClient.setBreakpointsRequest({
443443
lines: [breakpointLocation.line],
444444
breakpoints: [{ line: breakpointLocation.line, column: breakpointLocation.column }],

0 commit comments

Comments
 (0)