Skip to content

Commit bd1ee9f

Browse files
authored
Add localRoot & remoteRoot to the launch.json snippets (microsoft#3950)
- Will set localRoot to "${workspaceFolder}" by default - Will set remoteRoot to "." by default - PTVSD will pick this up and infer "." to be CWD.
1 parent 3956a4d commit bd1ee9f

5 files changed

Lines changed: 42 additions & 10 deletions

File tree

news/1 Enhancements/1385.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Add localRoot and remoteRoot defaults for Remote Debugging configuration in `launch.json`.

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -675,14 +675,20 @@
675675
}
676676
},
677677
{
678-
"label": "Python: Attach",
678+
"label": "Python: Remote Attach",
679679
"description": "%python.snippet.launch.attach.description%",
680680
"body": {
681681
"name": "Attach (Remote Debug)",
682682
"type": "python",
683683
"request": "attach",
684684
"port": 5678,
685-
"host": "localhost"
685+
"host": "localhost",
686+
"pathMappings": [
687+
{
688+
"localRoot": "${workspaceFolder}",
689+
"remoteRoot": "."
690+
}
691+
]
686692
}
687693
}
688694
],
@@ -2028,4 +2034,4 @@
20282034
"publisherDisplayName": "Microsoft",
20292035
"publisherId": "998b010b-e2af-44a5-a6cd-0b5fd3b9b6f8"
20302036
}
2031-
}
2037+
}

resources/default.launch.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,17 @@
77
"console": "integratedTerminal"
88
},
99
{
10-
"name": "Python: Attach",
10+
"name": "Python: Remote Attach",
1111
"type": "python",
1212
"request": "attach",
1313
"port": 5678,
14-
"host": "localhost"
14+
"host": "localhost",
15+
"pathMappings": [
16+
{
17+
"localRoot": "${workspaceFolder}",
18+
"remoteRoot": "."
19+
}
20+
]
1521
},
1622
{
1723
"name": "Python: Module",
@@ -55,4 +61,4 @@
5561
"program": "${file}",
5662
"console": "externalTerminal"
5763
}
58-
]
64+
]

src/client/debugger/extension/configuration/providers/remoteAttach.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,18 @@ const defaultPort = 5678;
1919
export class RemoteAttachDebugConfigurationProvider implements IDebugConfigurationProvider {
2020
public async buildConfiguration(input: MultiStepInput<DebugConfigurationState>, state: DebugConfigurationState): Promise<InputStep<DebugConfigurationState> | void> {
2121
const config: Partial<AttachRequestArguments> = {
22-
name: localize('python.snippet.launch.attach.label', 'Python: Attach')(),
22+
name: localize('python.snippet.launch.attach.label', 'Python: Remote Attach')(),
2323
type: DebuggerTypeName,
2424
request: 'attach',
2525
port: defaultPort,
26-
host: defaultHost
26+
host: defaultHost,
27+
pathMappings: [
28+
{
29+
// tslint:disable-next-line:no-invalid-template-strings
30+
localRoot: '${workspaceFolder}',
31+
remoteRoot: '.'
32+
}
33+
]
2734
};
2835

2936
config.host = await input.showInputBox({

src/test/debugger/extension/configuration/providers/remoteAttach.unit.test.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ suite('Debugging - Configuration Provider Remote Attach', () => {
8383
type: DebuggerTypeName,
8484
request: 'attach',
8585
port: 5678,
86-
host: 'localhost'
86+
host: 'localhost',
87+
pathMappings: [
88+
{
89+
localRoot: '${workspaceFolder}',
90+
remoteRoot: '.'
91+
}
92+
]
8793
};
8894

8995
expect(state.config).to.be.deep.equal(config);
@@ -110,7 +116,13 @@ suite('Debugging - Configuration Provider Remote Attach', () => {
110116
type: DebuggerTypeName,
111117
request: 'attach',
112118
port: 9999,
113-
host: 'Hello'
119+
host: 'Hello',
120+
pathMappings: [
121+
{
122+
localRoot: '${workspaceFolder}',
123+
remoteRoot: '.'
124+
}
125+
]
114126
};
115127

116128
expect(state.config).to.be.deep.equal(config);

0 commit comments

Comments
 (0)