Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/1 Enhancements/1492.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Enable Jinja template debugging as a default behavior when debugging Pyramid applications.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,8 @@
"args": [
"^\"\\${workspaceFolder}/development.ini\""
],
"pyramid": true
"pyramid": true,
"jinja": true
}
},
{
Expand Down
8 changes: 7 additions & 1 deletion src/client/debugger/configProviders/pythonV2Provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ export class PythonV2DebugConfigurationProvider extends BaseConfigurationProvide
if (this.serviceContainer.get<IPlatformService>(IPlatformService).isWindows) {
this.debugOption(debugOptions, DebugOptions.FixFilePathCase);
}
if (debugConfiguration.module && debugConfiguration.module.toUpperCase() === 'FLASK'
const isFlask = debugConfiguration.module && debugConfiguration.module.toUpperCase() === 'FLASK';
if ((debugConfiguration.pyramid || isFlask)
&& debugOptions.indexOf(DebugOptions.Jinja) === -1
&& debugConfiguration.jinja !== false) {
this.debugOption(debugOptions, DebugOptions.Jinja);
Expand All @@ -59,6 +60,11 @@ export class PythonV2DebugConfigurationProvider extends BaseConfigurationProvide
if (debugConfiguration.jinja) {
this.debugOption(debugOptions, DebugOptions.Jinja);
}
if (debugConfiguration.pyramid
&& debugOptions.indexOf(DebugOptions.Jinja) === -1
&& debugConfiguration.jinja !== false) {
this.debugOption(debugOptions, DebugOptions.Jinja);
}
if (debugConfiguration.redirectOutput || debugConfiguration.redirectOutput === undefined) {
this.debugOption(debugOptions, DebugOptions.RedirectOutput);
}
Expand Down
9 changes: 7 additions & 2 deletions src/test/debugger/configProvider/provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ import { IServiceContainer } from '../../../client/ioc/types';
setupIoc(pythonPath, isWindows, isMac, isLinux);
setupActiveEditor(pythonFile, PythonLanguage.language);

const execOutput = pyramidExists ? Promise.resolve({ stdout: pyramidFilePath }) : Promise.reject(new Error('No Module'));
const execOutput = pyramidExists ? Promise.resolve({ stdout: pyramidFilePath }) : Promise.reject('No Module');
pythonExecutionService.setup(e => e.exec(TypeMoq.It.isValue(args), TypeMoq.It.isAny()))
.returns(() => execOutput)
.verifiable(TypeMoq.Times.exactly(addPyramidDebugOption ? 1 : 0));
Expand All @@ -337,13 +337,18 @@ import { IServiceContainer } from '../../../client/ioc/types';
const debugConfig = await debugProvider.resolveDebugConfiguration!(workspaceFolder, options as any as DebugConfiguration);
if (shouldWork) {
expect(debugConfig).to.have.property('program', pserveFilePath);

if (provider.debugType === 'pythonExperimental') {
expect(debugConfig).to.have.property('debugOptions');
expect((debugConfig as any).debugOptions).contains(DebugOptions.Jinja);
}
} else {
expect(debugConfig!.program).to.be.not.equal(pserveFilePath);
}
pythonExecutionService.verifyAll();
fileSystem.verifyAll();
appShell.verifyAll();
}
}
test('Program is set for Pyramid (windows)', async () => {
await testPyramidConfiguration(true, false, false);
});
Expand Down