diff options
Diffstat (limited to 'editors/code/src')
-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 228a7ab75..cc5755611 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | import * as os from "os"; | 1 | import * as os from "os"; |
2 | import * as vscode from 'vscode'; | 2 | import * as vscode from 'vscode'; |
3 | import * as path from 'path'; | ||
3 | import * as ra from './rust-analyzer-api'; | 4 | import * as ra from './rust-analyzer-api'; |
4 | 5 | ||
5 | import { Cargo } from './cargo'; | 6 | import { 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 | ||