diff options
| author | vsrs <vit@conrlab.com> | 2020-05-11 18:49:45 +0300 |
|---|---|---|
| committer | vsrs <vit@conrlab.com> | 2020-05-11 18:49:45 +0300 |
| commit | e914d622ec378fd9efb9b20801c925ade806ef60 (patch) | |
| tree | 15621ffdb8f16867f6af6631c808b9faea3f4432 /editors/code/src/debug.ts | |
| parent | fee0a9fa5a3dd84400108b33a1e8225dc364a9fa (diff) | |
| download | rust-e914d622ec378fd9efb9b20801c925ade806ef60.tar.gz rust-e914d622ec378fd9efb9b20801c925ade806ef60.zip | |
DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
Diffstat (limited to 'editors/code/src/debug.ts')
| -rw-r--r-- | editors/code/src/debug.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 228a7ab75c0..cc5755611e7 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -1,5 +1,6 @@ import * as os from "os"; import * as vscode from 'vscode'; +import * as path from 'path'; import * as ra from './rust-analyzer-api'; import { Cargo } from './cargo'; @@ -72,8 +73,13 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom debugOutput.show(true); } + const wsFolder = path.normalize(vscode.workspace.workspaceFolders![0].uri.fsPath); // folder exists or RA is not active. + function simplifyPath(p: string): string { + return path.normalize(p).replace(wsFolder, '${workspaceRoot}'); + } + const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + const debugConfig = knownEngines[debugEngine.id](config, simplifyPath(executable), debugOptions.sourceFileMap); if (debugConfig.type in debugOptions.engineSettings) { const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; for (var key in settingsMap) { @@ -81,6 +87,10 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom } } + if (debugConfig.cwd) { + debugConfig.cwd = simplifyPath(debugConfig.cwd); + } + return debugConfig; } |
