@@ -6,7 +6,14 @@ import type * as ra from "./lsp_ext";
66import { Cargo } from "./toolchain" ;
77import type { Ctx } from "./ctx" ;
88import { createTaskFromRunnable , prepareEnv } from "./run" ;
9- import { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter } from "./util" ;
9+ import {
10+ execute ,
11+ isCargoRunnableArgs ,
12+ unwrapUndefinable ,
13+ log ,
14+ normalizeDriveLetter ,
15+ Env ,
16+ } from "./util" ;
1017import type { Config } from "./config" ;
1118
1219// Here we want to keep track on everything that's currently running
@@ -206,10 +213,7 @@ type SourceFileMap = {
206213 destination : string ;
207214} ;
208215
209- async function discoverSourceFileMap (
210- env : Record < string , string > ,
211- cwd : string ,
212- ) : Promise < SourceFileMap | undefined > {
216+ async function discoverSourceFileMap ( env : Env , cwd : string ) : Promise < SourceFileMap | undefined > {
213217 const sysroot = env [ "RUSTC_TOOLCHAIN" ] ;
214218 if ( sysroot ) {
215219 // let's try to use the default toolchain
@@ -232,7 +236,7 @@ type PropertyFetcher<Config, Input, Key extends keyof Config> = (
232236
233237type DebugConfigProvider < Type extends string , DebugConfig extends BaseDebugConfig < Type > > = {
234238 executableProperty : keyof DebugConfig ;
235- environmentProperty : PropertyFetcher < DebugConfig , Record < string , string > , keyof DebugConfig > ;
239+ environmentProperty : PropertyFetcher < DebugConfig , Env , keyof DebugConfig > ;
236240 runnableArgsProperty : PropertyFetcher < DebugConfig , ra . CargoRunnableArgs , keyof DebugConfig > ;
237241 sourceFileMapProperty ?: keyof DebugConfig ;
238242 type : Type ;
@@ -276,7 +280,7 @@ const knownEngines: {
276280 "environment" ,
277281 Object . entries ( env ) . map ( ( entry ) => ( {
278282 name : entry [ 0 ] ,
279- value : entry [ 1 ] ,
283+ value : entry [ 1 ] ?? "" ,
280284 } ) ) ,
281285 ] ,
282286 runnableArgsProperty : ( runnableArgs : ra . CargoRunnableArgs ) => [
@@ -304,10 +308,7 @@ const knownEngines: {
304308 } ,
305309} ;
306310
307- async function getDebugExecutable (
308- runnableArgs : ra . CargoRunnableArgs ,
309- env : Record < string , string > ,
310- ) : Promise < string > {
311+ async function getDebugExecutable ( runnableArgs : ra . CargoRunnableArgs , env : Env ) : Promise < string > {
311312 const cargo = new Cargo ( runnableArgs . workspaceRoot || "." , env ) ;
312313 const executable = await cargo . executableFromArgs ( runnableArgs ) ;
313314
@@ -328,7 +329,7 @@ function getDebugConfig(
328329 runnable : ra . Runnable ,
329330 runnableArgs : ra . CargoRunnableArgs ,
330331 executable : string ,
331- env : Record < string , string > ,
332+ env : Env ,
332333 sourceFileMap ?: Record < string , string > ,
333334) : vscode . DebugConfiguration {
334335 const {
@@ -380,14 +381,14 @@ type CodeLldbDebugConfig = {
380381 args : string [ ] ;
381382 sourceMap : Record < string , string > | undefined ;
382383 sourceLanguages : [ "rust" ] ;
383- env : Record < string , string > ;
384+ env : Env ;
384385} & BaseDebugConfig < "lldb" > ;
385386
386387type NativeDebugConfig = {
387388 target : string ;
388389 // See https://github.com/WebFreak001/code-debug/issues/359
389390 arguments : string ;
390- env : Record < string , string > ;
391+ env : Env ;
391392 valuesFormatting : "prettyPrinters" ;
392393} & BaseDebugConfig < "gdb" > ;
393394
0 commit comments