aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/debug.ts
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-05-13 13:51:15 +0100
committervsrs <[email protected]>2020-05-13 13:51:15 +0100
commit9ebb2acdca6c711cff7bfc84a410794739092dbe (patch)
tree06e296761ca573113c5093a09184e612189ed0ed /editors/code/src/debug.ts
parente914d622ec378fd9efb9b20801c925ade806ef60 (diff)
Use launch.json in Debug Lens sessions.
Add the possibility to use existing configurations via Debug Lens
Diffstat (limited to 'editors/code/src/debug.ts')
-rw-r--r--editors/code/src/debug.ts21
1 files changed, 19 insertions, 2 deletions
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index cc5755611..bbf3ff312 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -95,10 +95,27 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom
95} 95}
96 96
97export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise<boolean> { 97export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise<boolean> {
98 const debugConfig = await getDebugConfiguration(ctx, config); 98 let debugConfig: vscode.DebugConfiguration | undefined = undefined;
99 let message = "";
100
101 if (ctx.config.debug.useLaunchJson) {
102 const wsLaunchSection = vscode.workspace.getConfiguration("launch");
103 const configurations = wsLaunchSection.get<any[]>("configurations") || [];
104
105 const index = configurations.findIndex(c => c.name === config.label);
106 if (-1 !== index) {
107 debugConfig = configurations[index];
108 message = " (from launch.json)";
109 debugOutput.clear();
110 }
111 }
112 if (!debugConfig) {
113 debugConfig = await getDebugConfiguration(ctx, config);
114 }
115
99 if (!debugConfig) return false; 116 if (!debugConfig) return false;
100 117
101 debugOutput.appendLine("Launching debug configuration:"); 118 debugOutput.appendLine(`Launching debug configuration${message}:`);
102 debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); 119 debugOutput.appendLine(JSON.stringify(debugConfig, null, 2));
103 return vscode.debug.startDebugging(undefined, debugConfig); 120 return vscode.debug.startDebugging(undefined, debugConfig);
104} 121}