@@ -5,9 +5,10 @@ import * as ra from './lsp_ext';
55
66import { Cargo } from './toolchain' ;
77import { Ctx } from "./ctx" ;
8+ import { prepareEnv } from "./run" ;
89
910const debugOutput = vscode . window . createOutputChannel ( "Debug" ) ;
10- type DebugConfigProvider = ( config : ra . Runnable , executable : string , sourceFileMap ?: Record < string , string > ) => vscode . DebugConfiguration ;
11+ type DebugConfigProvider = ( config : ra . Runnable , executable : string , env : Record < string , string > , sourceFileMap ?: Record < string , string > ) => vscode . DebugConfiguration ;
1112
1213export async function makeDebugConfig ( ctx : Ctx , runnable : ra . Runnable ) : Promise < void > {
1314 const scope = ctx . activeRustEditor ?. document . uri ;
@@ -92,7 +93,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
9293 }
9394
9495 const executable = await getDebugExecutable ( runnable ) ;
95- const debugConfig = knownEngines [ debugEngine . id ] ( runnable , simplifyPath ( executable ) , debugOptions . sourceFileMap ) ;
96+ const env = prepareEnv ( runnable , ctx . config ) ;
97+ const debugConfig = knownEngines [ debugEngine . id ] ( runnable , simplifyPath ( executable ) , env , debugOptions . sourceFileMap ) ;
9698 if ( debugConfig . type in debugOptions . engineSettings ) {
9799 const settingsMap = ( debugOptions . engineSettings as any ) [ debugConfig . type ] ;
98100 for ( var key in settingsMap ) {
@@ -121,7 +123,7 @@ async function getDebugExecutable(runnable: ra.Runnable): Promise<string> {
121123 return executable ;
122124}
123125
124- function getLldbDebugConfig ( runnable : ra . Runnable , executable : string , sourceFileMap ?: Record < string , string > ) : vscode . DebugConfiguration {
126+ function getLldbDebugConfig ( runnable : ra . Runnable , executable : string , env : Record < string , string > , sourceFileMap ?: Record < string , string > ) : vscode . DebugConfiguration {
125127 return {
126128 type : "lldb" ,
127129 request : "launch" ,
@@ -130,18 +132,20 @@ function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFil
130132 args : runnable . args . executableArgs ,
131133 cwd : runnable . args . workspaceRoot ,
132134 sourceMap : sourceFileMap ,
133- sourceLanguages : [ "rust" ]
135+ sourceLanguages : [ "rust" ] ,
136+ env
134137 } ;
135138}
136139
137- function getCppvsDebugConfig ( runnable : ra . Runnable , executable : string , sourceFileMap ?: Record < string , string > ) : vscode . DebugConfiguration {
140+ function getCppvsDebugConfig ( runnable : ra . Runnable , executable : string , env : Record < string , string > , sourceFileMap ?: Record < string , string > ) : vscode . DebugConfiguration {
138141 return {
139142 type : ( os . platform ( ) === "win32" ) ? "cppvsdbg" : "cppdbg" ,
140143 request : "launch" ,
141144 name : runnable . label ,
142145 program : executable ,
143146 args : runnable . args . executableArgs ,
144147 cwd : runnable . args . workspaceRoot ,
145- sourceFileMap : sourceFileMap ,
148+ sourceFileMap,
149+ env,
146150 } ;
147151}
0 commit comments