Skip to content

Commit 2d44da5

Browse files
committed
pyramid debugging DonJayamanne#287
1 parent 30e1ab8 commit 2d44da5

File tree

2 files changed

+36
-9
lines changed

2 files changed

+36
-9
lines changed

package.json

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,8 @@
558558
"BreakOnSystemExitZero",
559559
"DjangoDebugging",
560560
"Sudo",
561-
"IgnoreDjangoTemplateWarnings"
561+
"IgnoreDjangoTemplateWarnings",
562+
"Pyramid"
562563
]
563564
},
564565
"default": [
@@ -791,6 +792,25 @@
791792
"RedirectOutput"
792793
]
793794
},
795+
{
796+
"name": "Pyramid",
797+
"type": "python",
798+
"request": "launch",
799+
"stopOnEntry": true,
800+
"pythonPath": "${config.python.pythonPath}",
801+
"cwd": "${workspaceRoot}",
802+
"env": null,
803+
"envFile": "${workspaceRoot}/.env",
804+
"args": [
805+
"${workspaceRoot}/development.ini"
806+
],
807+
"debugOptions": [
808+
"WaitOnAbnormalExit",
809+
"WaitOnNormalExit",
810+
"RedirectOutput",
811+
"Pyramid"
812+
]
813+
},
794814
{
795815
"name": "Watson",
796816
"type": "python",

src/client/debugger/Main.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,21 @@ export class PythonDebugger extends DebugSession {
180180
return Promise.resolve(true);
181181
}
182182
protected launchRequest(response: DebugProtocol.LaunchResponse, args: LaunchRequestArguments): void {
183+
// Add support for specifying just the directory where the python executable will be located
184+
// E.g. virtual directory name
185+
try {
186+
args.pythonPath = getPythonExecutable(args.pythonPath);
187+
}
188+
catch (ex) {
189+
}
190+
if (Array.isArray(args.debugOptions) && args.debugOptions.indexOf("Pyramid") >= 0) {
191+
if (fs.existsSync(args.pythonPath)) {
192+
args.program = path.join(path.dirname(args.pythonPath), "pserve");
193+
}
194+
else {
195+
args.program = "pserve";
196+
}
197+
}
183198
// Confirm the file exists
184199
if (typeof args.module !== 'string' || args.module.length === 0) {
185200
if (!fs.existsSync(args.program)) {
@@ -200,14 +215,6 @@ export class PythonDebugger extends DebugSession {
200215
Debug_HasEnvVaraibles: args.env && typeof args.env === "object" ? "true" : "false"
201216
}));
202217

203-
// Add support for specifying just the directory where the python executable will be located
204-
// E.g. virtual directory name
205-
try {
206-
args.pythonPath = getPythonExecutable(args.pythonPath);
207-
}
208-
catch (ex) {
209-
}
210-
211218
this.launchArgs = args;
212219
this.debugClient = CreateLaunchDebugClient(args, this);
213220
//this.debugClient.on('exit', () => this.sendEvent(new TerminatedEvent()));

0 commit comments

Comments
 (0)