aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvsrs <[email protected]>2020-05-11 16:49:45 +0100
committervsrs <[email protected]>2020-05-11 16:49:45 +0100
commite914d622ec378fd9efb9b20801c925ade806ef60 (patch)
tree15621ffdb8f16867f6af6631c808b9faea3f4432
parentfee0a9fa5a3dd84400108b33a1e8225dc364a9fa (diff)
DebugConfiguration simplification.
${workspaceRoot} substitution in generated DebugConfiguration.
-rw-r--r--editors/code/src/debug.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index 228a7ab75..cc5755611 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -1,5 +1,6 @@
1import * as os from "os"; 1import * as os from "os";
2import * as vscode from 'vscode'; 2import * as vscode from 'vscode';
3import * as path from 'path';
3import * as ra from './rust-analyzer-api'; 4import * as ra from './rust-analyzer-api';
4 5
5import { Cargo } from './cargo'; 6import { Cargo } from './cargo';
@@ -72,8 +73,13 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom
72 debugOutput.show(true); 73 debugOutput.show(true);
73 } 74 }
74 75
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
75 const executable = await getDebugExecutable(config); 81 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);
77 if (debugConfig.type in debugOptions.engineSettings) { 83 if (debugConfig.type in debugOptions.engineSettings) {
78 const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type]; 84 const settingsMap = (debugOptions.engineSettings as any)[debugConfig.type];
79 for (var key in settingsMap) { 85 for (var key in settingsMap) {
@@ -81,6 +87,10 @@ export async function getDebugConfiguration(ctx: Ctx, config: ra.Runnable): Prom
81 } 87 }
82 } 88 }
83 89
90 if (debugConfig.cwd) {
91 debugConfig.cwd = simplifyPath(debugConfig.cwd);
92 }
93
84 return debugConfig; 94 return debugConfig;
85} 95}
86 96