Skip to content

Commit

Permalink
Addressed reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
Kartik Raj committed May 20, 2019
1 parent 4bb0056 commit 2c6022a
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 3 deletions.
30 changes: 30 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -889,6 +889,36 @@
"description": "Debug port (default is 0, resulting in the use of a dynamic port).",
"default": 0
},
"pathMappings": {
"type": "array",
"label": "Path mappings.",
"items": {
"type": "object",
"label": "Path mapping",
"required": [
"localRoot",
"remoteRoot"
],
"properties": {
"localRoot": {
"type": "string",
"label": "Local source root.",
"default": "${workspaceFolder}"
},
"remoteRoot": {
"type": "string",
"label": "Remote source root.",
"default": "."
}
}
},
"default": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
]
},
"host": {
"type": "string",
"description": "IP address of the of the local debug server (default is localhost).",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,10 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
debugConfiguration.program = (await this.configurationProviderUtils.getPyramidStartupScriptFilePath(workspaceFolder))!;
}
if (!debugConfiguration.pathMappings) {
debugConfiguration.pathMappings = [];
debugConfiguration.pathMappings = workspaceFolder ? [{
localRoot: workspaceFolder.fsPath,
remoteRoot: '.'
}] : [];
}
// This is for backwards compatibility.
if (debugConfiguration.localRoot && debugConfiguration.remoteRoot) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ suite('Debugging - Config Resolver Launch', () => {
setupActiveEditor(pythonFile, PYTHON_LANGUAGE);
const debugConfig = await debugProvider.resolveDebugConfiguration!(workspaceFolder, { localRoot: 'abc', remoteRoot: 'remoteabc' } as LaunchRequestArguments);
expect(debugConfig).to.have.property('pathMappings');
expect(debugConfig!.pathMappings).to.deep.equal([{ localRoot: 'abc', remoteRoot: 'remoteabc' }]);
expect(debugConfig!.pathMappings).to.deep.equal([{ localRoot: workspaceFolder.uri.fsPath, remoteRoot: '.' }, { localRoot: 'abc', remoteRoot: 'remoteabc' }]);
});
async function testFixFilePathCase(isWindows: boolean, isMac: boolean, isLinux: boolean) {
const pythonPath = `PythonPath_${new Date().toString()}`;
Expand Down
5 changes: 4 additions & 1 deletion src/test/testing/common/debugLauncher.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,10 @@ suite('Unit Tests - Debug Launcher', () => {
expected.debugOptions.push(DebugOptions.FixFilePathCase);
}
if (!expected.pathMappings) {
expected.pathMappings = [];
expected.pathMappings = expected.workspaceFolder ? [{
localRoot: expected.workspaceFolder.fsPath,
remoteRoot: '.'
}] : [];
}
// This is for backwards compatibility.
if (expected.localRoot && expected.remoteRoot) {
Expand Down

0 comments on commit 2c6022a

Please sign in to comment.