Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 92e69f1

Browse files
Tim Etchellstetchel
Tim Etchells
authored andcommitted
Extend debug timeout for Appsody projects
Also fix overwriting custom launch changes Signed-off-by: Tim Etchells <timetchells@ibm.com>
1 parent 083de46 commit 92e69f1

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

dev/src/codewind/project/DebugUtils.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,12 @@ export default class DebugUtils {
174174
for (let i = 0; i < launchConfigs.length; i++) {
175175
const existingLaunch: vscode.DebugConfiguration = launchConfigs[i];
176176
if (existingLaunch != null && existingLaunch.name === debugName) {
177-
const updatedLaunch = DebugUtils.generateDebugLaunchConfig(debugName, project);
177+
const newLaunch = DebugUtils.generateDebugLaunchConfig(debugName, project);
178+
const mergedLaunch = Object.assign(existingLaunch, newLaunch);
178179

179-
if (updatedLaunch == null) {
180-
Log.e(`Failed to generate debug launch config for ${project.name} when a config already existed`);
181-
continue;
182-
}
183-
184-
Log.d(`Replacing existing debug launch ${debugName}`);
185-
launchConfigs[i] = updatedLaunch;
186-
launchToWrite = updatedLaunch;
180+
Log.d(`Updating existing debug launch ${debugName}`);
181+
launchConfigs[i] = mergedLaunch;
182+
launchToWrite = mergedLaunch;
187183
break;
188184
}
189185
}
@@ -210,10 +206,15 @@ export default class DebugUtils {
210206

211207
private static readonly RQ_ATTACH: string = "attach"; // non-nls
212208

213-
private static generateDebugLaunchConfig(debugName: string, project: Project): vscode.DebugConfiguration | undefined {
209+
private static generateDebugLaunchConfig(debugName: string, project: Project): vscode.DebugConfiguration {
214210

215211
switch (project.type.debugType) {
216212
case ProjectType.DebugTypes.JAVA: {
213+
let timeout = 30 * 1000;
214+
if (project.type.isAppsody) {
215+
timeout = 180 * 1000;
216+
}
217+
217218
return {
218219
type: project.type.debugType.toString(),
219220
name: debugName,
@@ -222,6 +223,7 @@ export default class DebugUtils {
222223
port: project.exposedDebugPort,
223224
// sourcePaths: project.localPath + "/src/"
224225
projectName: project.name,
226+
timeout,
225227
};
226228
}
227229
case ProjectType.DebugTypes.NODE: {
@@ -238,7 +240,7 @@ export default class DebugUtils {
238240
};
239241
}
240242
default:
241-
return undefined;
243+
throw new Error("No debug type set for " + project.name);
242244
}
243245
}
244246
}

dev/translations/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100
"restartSuccess": "Finished restarting {{ projectName }} in {{ startMode }} mode.",
101101
"genericErrorProjectRestart": "{{ projectName }} failed to restart.",
102102
"restartFailure": "Failed to restart {{ projectName }} in {{ startMode }} mode.",
103-
"restartFailureWithReason": "Failed to restart {{ projectName }} in {{ startMode }} mode: {{ reason }}.",
103+
"restartFailureWithReason": "Failed to restart {{ projectName }} in {{ startMode }} mode: {{- reason }}.",
104104
"restartFailedReasonDebugFailure": "attaching the debugger failed. Try attaching the debugger again",
105105
"restartFailedReasonTimeout": "failed to restart within {{ timeoutS }} seconds",
106106
"restartFailedReasonDisconnect": "Codewind disconnected",

0 commit comments

Comments
 (0)