Skip to content

Commit e914d62

Browse files
committed
DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
1 parent fee0a9f commit e914d62

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

editors/code/src/debug.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import * as os from "os";
22
import * as vscode from 'vscode';
3+
import * as path from 'path';
34
import * as ra from './rust-analyzer-api';
45

56
import { Cargo } from './cargo';
@@ -72,15 +73,24 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom
7273
debugOutput.show(true);
7374
}
7475

76+
const wsFolder = path.normalize(vscode.workspace.workspaceFolders![0].uri.fsPath); // folder exists or RA is not active.
77+
function simplifyPath(p: string): string {
78+
return path.normalize(p).replace(wsFolder, '${workspaceRoot}');
79+
}
80+
7581
const executable = await getDebugExecutable(config);
76-
const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap);
82+
const debugConfig = knownEngines[debugEngine.id](config, simplifyPath(executable), debugOptions.sourceFileMap);
7783
if (debugConfig.type in debugOptions.engineSettings) {
7884
const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type];
7985
for (var key in settingsMap) {
8086
debugConfig[key] = settingsMap[key];
8187
}
8288
}
8389

90+
if (debugConfig.cwd) {
91+
debugConfig.cwd = simplifyPath(debugConfig.cwd);
92+
}
93+
8494
return debugConfig;
8595
}
8696

0 commit comments

Comments
 (0)