diff options
author | vsrs <[email protected]> | 2020-05-13 13:51:15 +0100 |
---|---|---|
committer | vsrs <[email protected]> | 2020-05-13 13:51:15 +0100 |
commit | 9ebb2acdca6c711cff7bfc84a410794739092dbe (patch) | |
tree | 06e296761ca573113c5093a09184e612189ed0ed /editors/code/src | |
parent | e914d622ec378fd9efb9b20801c925ade806ef60 (diff) |
Use launch.json in Debug Lens sessions.
Add the possibility to use existing configurations via Debug Lens
Diffstat (limited to 'editors/code/src')
-rw-r--r-- | editors/code/src/config.ts | 1 | ||||
-rw-r--r-- | editors/code/src/debug.ts | 21 |
2 files changed, 20 insertions, 2 deletions
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index be2e27aec..24002483d 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts | |||
@@ -117,6 +117,7 @@ export class Config { | |||
117 | engineSettings: this.get<object>("debug.engineSettings"), | 117 | engineSettings: this.get<object>("debug.engineSettings"), |
118 | openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"), | 118 | openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"), |
119 | sourceFileMap: sourceFileMap, | 119 | sourceFileMap: sourceFileMap, |
120 | useLaunchJson: this.get<object>("debug.useLaunchJson"), | ||
120 | }; | 121 | }; |
121 | } | 122 | } |
122 | } | 123 | } |
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 | ||
97 | export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise<boolean> { | 97 | export 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 | } |