diff options
| author | vsrs <vit@conrlab.com> | 2020-05-13 15:51:15 +0300 |
|---|---|---|
| committer | vsrs <vit@conrlab.com> | 2020-05-13 15:51:15 +0300 |
| commit | 9ebb2acdca6c711cff7bfc84a410794739092dbe (patch) | |
| tree | 06e296761ca573113c5093a09184e612189ed0ed /editors/code/src | |
| parent | e914d622ec378fd9efb9b20801c925ade806ef60 (diff) | |
| download | rust-9ebb2acdca6c711cff7bfc84a410794739092dbe.tar.gz rust-9ebb2acdca6c711cff7bfc84a410794739092dbe.zip | |
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 be2e27aecca..24002483d44 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -117,6 +117,7 @@ export class Config { engineSettings: this.get<object>("debug.engineSettings"), openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"), sourceFileMap: sourceFileMap, + useLaunchJson: this.get<object>("debug.useLaunchJson"), }; } } diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index cc5755611e7..bbf3ff31204 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 } export async function startDebugSession(ctx: Ctx, config: ra.Runnable): Promise<boolean> { - const debugConfig = await getDebugConfiguration(ctx, config); + let debugConfig: vscode.DebugConfiguration | undefined = undefined; + let message = ""; + + if (ctx.config.debug.useLaunchJson) { + const wsLaunchSection = vscode.workspace.getConfiguration("launch"); + const configurations = wsLaunchSection.get<any[]>("configurations") || []; + + const index = configurations.findIndex(c => c.name === config.label); + if (-1 !== index) { + debugConfig = configurations[index]; + message = " (from launch.json)"; + debugOutput.clear(); + } + } + if (!debugConfig) { + debugConfig = await getDebugConfiguration(ctx, config); + } + if (!debugConfig) return false; - debugOutput.appendLine("Launching debug configuration:"); + debugOutput.appendLine(`Launching debug configuration${message}:`); debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); return vscode.debug.startDebugging(undefined, debugConfig); } |
