From 1f216a285eeea14c32690557a6483e16d180f7b2 Mon Sep 17 00:00:00 2001 From: Derek Keeler Date: Wed, 9 Jan 2019 14:50:40 -0800 Subject: [PATCH 1/3] Add localRoot & remoteRoot to the launch.json snippets For #1385 - Will set localRoot to "${workspaceFolder}" by default - Will set remoteRoot to "." by default - PTVSD will (eventually) pick this up and infer "." to be CWD. --- package.json | 12 +++++++++--- resources/default.launch.json | 12 +++++++++--- .../configuration/providers/remoteAttach.ts | 11 +++++++++-- 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 347d7a092bf8..155692b1aaf4 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..30de7b044022 100644 --- a/resources/default.launch.json +++ b/resources/default.launch.json @@ -7,11 +7,17 @@ "console": "integratedTerminal" }, { - "name": "Python: Attach", + "name": "Python: Attach (Remote Debug)", "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..11b853319bdc 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: Attach (Remote Debug)')(), 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({ From 77b749fb01b2b744d6480de9b9ed9e6fab4b7da9 Mon Sep 17 00:00:00 2001 From: Derek Keeler Date: Wed, 9 Jan 2019 15:28:32 -0800 Subject: [PATCH 2/3] Correct unit tests to accomodate this change --- .../providers/remoteAttach.unit.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) 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); From e6280b2dc29935b418660702297771e17a197c24 Mon Sep 17 00:00:00 2001 From: Derek Keeler Date: Wed, 9 Jan 2019 16:52:43 -0800 Subject: [PATCH 3/3] Make configuration name consistent across sources - add news --- news/1 Enhancements/1385.md | 1 + package.json | 2 +- resources/default.launch.json | 2 +- .../debugger/extension/configuration/providers/remoteAttach.ts | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 news/1 Enhancements/1385.md 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 155692b1aaf4..123e81b4438b 100644 --- a/package.json +++ b/package.json @@ -675,7 +675,7 @@ } }, { - "label": "Python: (Remote Attach)", + "label": "Python: Remote Attach", "description": "%python.snippet.launch.attach.description%", "body": { "name": "Attach (Remote Debug)", diff --git a/resources/default.launch.json b/resources/default.launch.json index 30de7b044022..613054b22b3c 100644 --- a/resources/default.launch.json +++ b/resources/default.launch.json @@ -7,7 +7,7 @@ "console": "integratedTerminal" }, { - "name": "Python: Attach (Remote Debug)", + "name": "Python: Remote Attach", "type": "python", "request": "attach", "port": 5678, diff --git a/src/client/debugger/extension/configuration/providers/remoteAttach.ts b/src/client/debugger/extension/configuration/providers/remoteAttach.ts index 11b853319bdc..e1dbc2d6d9aa 100644 --- a/src/client/debugger/extension/configuration/providers/remoteAttach.ts +++ b/src/client/debugger/extension/configuration/providers/remoteAttach.ts @@ -19,7 +19,7 @@ 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 (Remote Debug)')(), + name: localize('python.snippet.launch.attach.label', 'Python: Remote Attach')(), type: DebuggerTypeName, request: 'attach', port: defaultPort,