diff --git a/news/1 Enhancements/1385.md b/news/1 Enhancements/1385.md new file mode 100644 index 000000000000..ebb3626de33a --- /dev/null +++ b/news/1 Enhancements/1385.md @@ -0,0 +1 @@ +Add localRoot and remoteRoot defaults for Remote Debugging configuration in `launch.json`. \ No newline at end of file diff --git a/package.json b/package.json index 347d7a092bf8..123e81b4438b 100644 --- a/package.json +++ b/package.json @@ -675,14 +675,20 @@ } }, { - "label": "Python: Attach", + "label": "Python: Remote Attach", "description": "%python.snippet.launch.attach.description%", "body": { "name": "Attach (Remote Debug)", "type": "python", "request": "attach", "port": 5678, - "host": "localhost" + "host": "localhost", + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "." + } + ] } } ], @@ -1996,4 +2002,4 @@ "publisherDisplayName": "Microsoft", "publisherId": "998b010b-e2af-44a5-a6cd-0b5fd3b9b6f8" } -} +} \ No newline at end of file diff --git a/resources/default.launch.json b/resources/default.launch.json index 10f90e0b4286..613054b22b3c 100644 --- a/resources/default.launch.json +++ b/resources/default.launch.json @@ -7,11 +7,17 @@ "console": "integratedTerminal" }, { - "name": "Python: Attach", + "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 5678, - "host": "localhost" + "host": "localhost", + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "." + } + ] }, { "name": "Python: Module", @@ -55,4 +61,4 @@ "program": "${file}", "console": "externalTerminal" } -] +] \ No newline at end of file diff --git a/src/client/debugger/extension/configuration/providers/remoteAttach.ts b/src/client/debugger/extension/configuration/providers/remoteAttach.ts index 9d6fee8c307e..e1dbc2d6d9aa 100644 --- a/src/client/debugger/extension/configuration/providers/remoteAttach.ts +++ b/src/client/debugger/extension/configuration/providers/remoteAttach.ts @@ -19,11 +19,18 @@ const defaultPort = 5678; export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurationProvider { public async buildConfiguration(input: MultiStepInput, state: DebugConfigurationState): Promise | void> { const config: Partial = { - name: localize('python.snippet.launch.attach.label', 'Python: Attach')(), + name: localize('python.snippet.launch.attach.label', 'Python: Remote Attach')(), type: DebuggerTypeName, request: 'attach', port: defaultPort, - host: defaultHost + host: defaultHost, + pathMappings: [ + { + // tslint:disable-next-line:no-invalid-template-strings + localRoot: '${workspaceFolder}', + remoteRoot: '.' + } + ] }; config.host = await input.showInputBox({ diff --git a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts index b91f815b5e57..d93fd414f112 100644 --- a/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts +++ b/src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts @@ -83,7 +83,13 @@ suite('Debugging - Configuration Provider Remote Attach', () => { type: DebuggerTypeName, request: 'attach', port: 5678, - host: 'localhost' + host: 'localhost', + pathMappings: [ + { + localRoot: '${workspaceFolder}', + remoteRoot: '.' + } + ] }; expect(state.config).to.be.deep.equal(config); @@ -110,7 +116,13 @@ suite('Debugging - Configuration Provider Remote Attach', () => { type: DebuggerTypeName, request: 'attach', port: 9999, - host: 'Hello' + host: 'Hello', + pathMappings: [ + { + localRoot: '${workspaceFolder}', + remoteRoot: '.' + } + ] }; expect(state.config).to.be.deep.equal(config);