Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

Commit d0b9df3

Browse files
Fix variable reference bug in package.json for new vscode engine (#435)
Signed-off-by: Jinbo Wang <[email protected]>
1 parent c02b07b commit d0b9df3

File tree

2 files changed

+21
-15
lines changed

2 files changed

+21
-15
lines changed

package.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,8 @@
143143
"name": "Arduino",
144144
"type": "arduino",
145145
"request": "launch",
146-
"program": "$${{file}}",
147-
"cwd": "$${{workspaceFolder}}",
146+
"program": "^\"\\${file}\"",
147+
"cwd": "^\"\\${workspaceFolder}\"",
148148
"MIMode": "gdb",
149149
"targetArchitecture": "arm",
150150
"miDebuggerPath": "",
@@ -155,7 +155,7 @@
155155
"text": "target remote localhost:3333"
156156
},
157157
{
158-
"text": "file $${{file}}"
158+
"text": "^\"file \\${file}\""
159159
},
160160
{
161161
"text": "load"

src/debug/configurationProvider.ts

+18-12
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,27 @@ export class ArduinoDebugConfigurationProvider implements vscode.DebugConfigurat
2020

2121
public provideDebugConfigurations(folder: vscode.WorkspaceFolder | undefined, token?: vscode.CancellationToken):
2222
vscode.ProviderResult<vscode.DebugConfiguration[]> {
23-
return [{
23+
return [
24+
this.getDefaultDebugSettings(folder),
25+
];
26+
}
27+
28+
// Try to add all missing attributes to the debug configuration being launched.
29+
public resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken):
30+
vscode.ProviderResult<vscode.DebugConfiguration> {
31+
if (!config || !config.request) {
32+
config = this.getDefaultDebugSettings(folder);
33+
}
34+
return this.resolveDebugConfigurationAsync(config);
35+
}
36+
37+
private getDefaultDebugSettings(folder: vscode.WorkspaceFolder | undefined) {
38+
return {
2439
name: "Arduino",
2540
type: "arduino",
2641
request: "launch",
2742
program: "${file}",
28-
cwd: folder,
43+
cwd: "${workspaceFolder}",
2944
MIMode: "gdb",
3045
targetArchitecture: "arm",
3146
miDebuggerPath: "",
@@ -53,16 +68,7 @@ export class ArduinoDebugConfigurationProvider implements vscode.DebugConfigurat
5368
launchCompleteCommand: "exec-continue",
5469
filterStderr: true,
5570
args: [],
56-
}];
57-
}
58-
59-
// Try to add all missing attributes to the debug configuration being launched.
60-
public resolveDebugConfiguration(folder: vscode.WorkspaceFolder | undefined, config: vscode.DebugConfiguration, token?: vscode.CancellationToken):
61-
vscode.ProviderResult<vscode.DebugConfiguration> {
62-
if (config && !config.cwd) {
63-
config.cwd = folder;
64-
}
65-
return this.resolveDebugConfigurationAsync(config);
71+
};
6672
}
6773

6874
private async resolveDebugConfigurationAsync(config: vscode.DebugConfiguration) {

0 commit comments

Comments
 (0)