@@ -6,7 +6,7 @@ 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 { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter , Env } from "./util" ;
1010import type { Config } from "./config" ;
1111
1212// Here we want to keep track on everything that's currently running
@@ -108,9 +108,9 @@ async function getDebugConfiguration(
108108
109109 await vscode . window . showErrorMessage (
110110 `Install [CodeLLDB](command:${ commandCodeLLDB } "Open CodeLLDB")` +
111- `, [lldb-dap](command:${ commandLLDBDap } "Open lldb-dap")` +
112- `, [C/C++](command:${ commandCCpp } "Open C/C++") ` +
113- `or [Native Debug](command:${ commandNativeDebug } "Open Native Debug") for debugging.` ,
111+ `, [lldb-dap](command:${ commandLLDBDap } "Open lldb-dap")` +
112+ `, [C/C++](command:${ commandCCpp } "Open C/C++") ` +
113+ `or [Native Debug](command:${ commandNativeDebug } "Open Native Debug") for debugging.` ,
114114 ) ;
115115 return ;
116116 }
@@ -124,7 +124,7 @@ async function getDebugConfiguration(
124124 ! isMultiFolderWorkspace || ! runnableArgs . workspaceRoot
125125 ? firstWorkspace
126126 : workspaceFolders . find ( ( w ) => runnableArgs . workspaceRoot ?. includes ( w . uri . fsPath ) ) ||
127- firstWorkspace ;
127+ firstWorkspace ;
128128
129129 const workspace = unwrapUndefinable ( maybeWorkspace ) ;
130130 const wsFolder = normalizeDriveLetter ( path . normalize ( workspace . uri . fsPath ) ) ;
@@ -207,7 +207,7 @@ type SourceFileMap = {
207207} ;
208208
209209async function discoverSourceFileMap (
210- env : Record < string , string > ,
210+ env : Env ,
211211 cwd : string ,
212212) : Promise < SourceFileMap | undefined > {
213213 const sysroot = env [ "RUSTC_TOOLCHAIN" ] ;
@@ -232,7 +232,7 @@ type PropertyFetcher<Config, Input, Key extends keyof Config> = (
232232
233233type DebugConfigProvider < Type extends string , DebugConfig extends BaseDebugConfig < Type > > = {
234234 executableProperty : keyof DebugConfig ;
235- environmentProperty : PropertyFetcher < DebugConfig , Record < string , string > , keyof DebugConfig > ;
235+ environmentProperty : PropertyFetcher < DebugConfig , Env , keyof DebugConfig > ;
236236 runnableArgsProperty : PropertyFetcher < DebugConfig , ra . CargoRunnableArgs , keyof DebugConfig > ;
237237 sourceFileMapProperty ?: keyof DebugConfig ;
238238 type : Type ;
@@ -276,7 +276,7 @@ const knownEngines: {
276276 "environment" ,
277277 Object . entries ( env ) . map ( ( entry ) => ( {
278278 name : entry [ 0 ] ,
279- value : entry [ 1 ] ,
279+ value : entry [ 1 ] ?? "" ,
280280 } ) ) ,
281281 ] ,
282282 runnableArgsProperty : ( runnableArgs : ra . CargoRunnableArgs ) => [
@@ -306,7 +306,7 @@ const knownEngines: {
306306
307307async function getDebugExecutable (
308308 runnableArgs : ra . CargoRunnableArgs ,
309- env : Record < string , string > ,
309+ env : Env ,
310310) : Promise < string > {
311311 const cargo = new Cargo ( runnableArgs . workspaceRoot || "." , env ) ;
312312 const executable = await cargo . executableFromArgs ( runnableArgs ) ;
@@ -328,7 +328,7 @@ function getDebugConfig(
328328 runnable : ra . Runnable ,
329329 runnableArgs : ra . CargoRunnableArgs ,
330330 executable : string ,
331- env : Record < string , string > ,
331+ env : Env ,
332332 sourceFileMap ?: Record < string , string > ,
333333) : vscode . DebugConfiguration {
334334 const {
@@ -380,14 +380,14 @@ type CodeLldbDebugConfig = {
380380 args : string [ ] ;
381381 sourceMap : Record < string , string > | undefined ;
382382 sourceLanguages : [ "rust" ] ;
383- env : Record < string , string > ;
383+ env : Env ;
384384} & BaseDebugConfig < "lldb" > ;
385385
386386type NativeDebugConfig = {
387387 target : string ;
388388 // See https://github.com/WebFreak001/code-debug/issues/359
389389 arguments : string ;
390- env : Record < string , string > ;
390+ env : Env ;
391391 valuesFormatting : "prettyPrinters" ;
392392} & BaseDebugConfig < "gdb" > ;
393393
0 commit comments