Skip to content

Commit 238d034

Browse files
committed
complete #518
1 parent 759e4de commit 238d034

3 files changed

Lines changed: 32 additions & 2 deletions

File tree

package.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,11 @@
232232
"program"
233233
],
234234
"properties": {
235+
"module": {
236+
"type": "string",
237+
"description": "Name of the module to be debugged.",
238+
"default": ""
239+
},
235240
"program": {
236241
"type": "string",
237242
"description": "Absolute path to the program.",
@@ -374,6 +379,21 @@
374379
"stopOnEntry": true,
375380
"pythonPath": "${config.python.pythonPath}",
376381
"program": "${file}",
382+
"cwd": "null",
383+
"debugOptions": [
384+
"WaitOnAbnormalExit",
385+
"WaitOnNormalExit",
386+
"RedirectOutput"
387+
]
388+
},
389+
{
390+
"name": "Python Module",
391+
"type": "python",
392+
"request": "launch",
393+
"stopOnEntry": true,
394+
"pythonPath": "${config.python.pythonPath}",
395+
"module": "module.name",
396+
"cwd": "${workspaceRoot}",
377397
"debugOptions": [
378398
"WaitOnAbnormalExit",
379399
"WaitOnNormalExit",
@@ -387,6 +407,7 @@
387407
"stopOnEntry": true,
388408
"pythonPath": "${config.python.pythonPath}",
389409
"program": "${file}",
410+
"cwd": "null",
390411
"console": "integratedTerminal",
391412
"debugOptions": [
392413
"WaitOnAbnormalExit",
@@ -400,6 +421,7 @@
400421
"stopOnEntry": true,
401422
"pythonPath": "${config.python.pythonPath}",
402423
"program": "${file}",
424+
"cwd": "null",
403425
"console": "externalTerminal",
404426
"debugOptions": [
405427
"WaitOnAbnormalExit",
@@ -413,6 +435,7 @@
413435
"stopOnEntry": true,
414436
"pythonPath": "${config.python.pythonPath}",
415437
"program": "${workspaceRoot}/manage.py",
438+
"cwd": "null",
416439
"args": [
417440
"runserver",
418441
"--noreload"
@@ -431,6 +454,7 @@
431454
"stopOnEntry": false,
432455
"pythonPath": "${config.python.pythonPath}",
433456
"program": "fully qualified path fo 'flask' executable. Generally located along with python interpreter",
457+
"cwd": "null",
434458
"env": {
435459
"FLASK_APP": "${workspaceRoot}/quickstart/app.py"
436460
},
@@ -452,6 +476,7 @@
452476
"stopOnEntry": false,
453477
"pythonPath": "${config.python.pythonPath}",
454478
"program": "${workspaceRoot}/run.py",
479+
"cwd": "null",
455480
"args": [],
456481
"debugOptions": [
457482
"WaitOnAbnormalExit",
@@ -466,6 +491,7 @@
466491
"stopOnEntry": true,
467492
"pythonPath": "${config.python.pythonPath}",
468493
"program": "${workspaceRoot}/console.py",
494+
"cwd": "null",
469495
"args": [
470496
"dev",
471497
"runserver",

src/client/debugger/Common/Contracts.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"use strict";
22
import * as net from "net";
3-
import {DebugProtocol} from "vscode-debugprotocol";
4-
import {OutputEvent} from "vscode-debugadapter";
3+
import { DebugProtocol } from "vscode-debugprotocol";
4+
import { OutputEvent } from "vscode-debugadapter";
55

66
export class TelemetryEvent extends OutputEvent {
77
body: {
@@ -42,6 +42,7 @@ export interface ExceptionHandling {
4242

4343
export interface LaunchRequestArguments extends DebugProtocol.LaunchRequestArguments {
4444
/** An absolute path to the program to debug. */
45+
module?: string;
4546
program: string;
4647
pythonPath: string;
4748
/** Automatically stop target after launch. If not specified, target does not stop. */

src/client/debugger/DebugClients/LocalDebugClient.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ export class LocalDebugClient extends DebugClient {
181181
}
182182

183183
let programArgs = Array.isArray(this.args.args) && this.args.args.length > 0 ? this.args.args : [];
184+
if (typeof this.args.module === 'string' && this.args.module.length > 0) {
185+
return [vsDebugOptions, '-m', this.args.module].concat(programArgs);
186+
}
184187
return [vsDebugOptions, this.args.program].concat(programArgs);
185188
// Use this ability to debug unit tests or modules
186189
// Adding breakpoints programatically to the first executable line of the test program

0 commit comments

Comments
 (0)