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

Commit

Permalink
Extend debug timeout for Appsody projects
Browse files Browse the repository at this point in the history
Also fix overwriting custom launch changes

Signed-off-by: Tim Etchells <[email protected]>
  • Loading branch information
Tim Etchells authored and tetchel committed Jun 10, 2020
1 parent 083de46 commit 92e69f1
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions dev/src/codewind/project/DebugUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,16 +174,12 @@ export default class DebugUtils {
for (let i = 0; i < launchConfigs.length; i++) {
const existingLaunch: vscode.DebugConfiguration = launchConfigs[i];
if (existingLaunch != null && existingLaunch.name === debugName) {
const updatedLaunch = DebugUtils.generateDebugLaunchConfig(debugName, project);
const newLaunch = DebugUtils.generateDebugLaunchConfig(debugName, project);
const mergedLaunch = Object.assign(existingLaunch, newLaunch);

if (updatedLaunch == null) {
Log.e(`Failed to generate debug launch config for ${project.name} when a config already existed`);
continue;
}

Log.d(`Replacing existing debug launch ${debugName}`);
launchConfigs[i] = updatedLaunch;
launchToWrite = updatedLaunch;
Log.d(`Updating existing debug launch ${debugName}`);
launchConfigs[i] = mergedLaunch;
launchToWrite = mergedLaunch;
break;
}
}
Expand All @@ -210,10 +206,15 @@ export default class DebugUtils {

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

private static generateDebugLaunchConfig(debugName: string, project: Project): vscode.DebugConfiguration | undefined {
private static generateDebugLaunchConfig(debugName: string, project: Project): vscode.DebugConfiguration {

switch (project.type.debugType) {
case ProjectType.DebugTypes.JAVA: {
let timeout = 30 * 1000;
if (project.type.isAppsody) {
timeout = 180 * 1000;
}

return {
type: project.type.debugType.toString(),
name: debugName,
Expand All @@ -222,6 +223,7 @@ export default class DebugUtils {
port: project.exposedDebugPort,
// sourcePaths: project.localPath + "/src/"
projectName: project.name,
timeout,
};
}
case ProjectType.DebugTypes.NODE: {
Expand All @@ -238,7 +240,7 @@ export default class DebugUtils {
};
}
default:
return undefined;
throw new Error("No debug type set for " + project.name);
}
}
}
2 changes: 1 addition & 1 deletion dev/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"restartSuccess": "Finished restarting {{ projectName }} in {{ startMode }} mode.",
"genericErrorProjectRestart": "{{ projectName }} failed to restart.",
"restartFailure": "Failed to restart {{ projectName }} in {{ startMode }} mode.",
"restartFailureWithReason": "Failed to restart {{ projectName }} in {{ startMode }} mode: {{ reason }}.",
"restartFailureWithReason": "Failed to restart {{ projectName }} in {{ startMode }} mode: {{- reason }}.",
"restartFailedReasonDebugFailure": "attaching the debugger failed. Try attaching the debugger again",
"restartFailedReasonTimeout": "failed to restart within {{ timeoutS }} seconds",
"restartFailedReasonDisconnect": "Codewind disconnected",
Expand Down

0 comments on commit 92e69f1

Please sign in to comment.