mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 05:38:46 +00:00
DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
This commit is contained in:
parent
fee0a9fa5a
commit
e914d622ec
1 changed files with 11 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue