@@ -6,7 +6,7 @@ import type * as ra from "./lsp_ext";
6
6
import { Cargo } from "./toolchain" ;
7
7
import type { Ctx } from "./ctx" ;
8
8
import { createTaskFromRunnable , prepareEnv } from "./run" ;
9
- import { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter } from "./util" ;
9
+ import { execute , isCargoRunnableArgs , unwrapUndefinable , log , normalizeDriveLetter , Env } from "./util" ;
10
10
import type { Config } from "./config" ;
11
11
12
12
// Here we want to keep track on everything that's currently running
@@ -108,9 +108,9 @@ async function getDebugConfiguration(
108
108
109
109
await vscode . window . showErrorMessage (
110
110
`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.` ,
114
114
) ;
115
115
return ;
116
116
}
@@ -124,7 +124,7 @@ async function getDebugConfiguration(
124
124
! isMultiFolderWorkspace || ! runnableArgs . workspaceRoot
125
125
? firstWorkspace
126
126
: workspaceFolders . find ( ( w ) => runnableArgs . workspaceRoot ?. includes ( w . uri . fsPath ) ) ||
127
- firstWorkspace ;
127
+ firstWorkspace ;
128
128
129
129
const workspace = unwrapUndefinable ( maybeWorkspace ) ;
130
130
const wsFolder = normalizeDriveLetter ( path . normalize ( workspace . uri . fsPath ) ) ;
@@ -207,7 +207,7 @@ type SourceFileMap = {
207
207
} ;
208
208
209
209
async function discoverSourceFileMap (
210
- env : Record < string , string > ,
210
+ env : Env ,
211
211
cwd : string ,
212
212
) : Promise < SourceFileMap | undefined > {
213
213
const sysroot = env [ "RUSTC_TOOLCHAIN" ] ;
@@ -232,7 +232,7 @@ type PropertyFetcher<Config, Input, Key extends keyof Config> = (
232
232
233
233
type DebugConfigProvider < Type extends string , DebugConfig extends BaseDebugConfig < Type > > = {
234
234
executableProperty : keyof DebugConfig ;
235
- environmentProperty : PropertyFetcher < DebugConfig , Record < string , string > , keyof DebugConfig > ;
235
+ environmentProperty : PropertyFetcher < DebugConfig , Env , keyof DebugConfig > ;
236
236
runnableArgsProperty : PropertyFetcher < DebugConfig , ra . CargoRunnableArgs , keyof DebugConfig > ;
237
237
sourceFileMapProperty ?: keyof DebugConfig ;
238
238
type : Type ;
@@ -276,7 +276,7 @@ const knownEngines: {
276
276
"environment" ,
277
277
Object . entries ( env ) . map ( ( entry ) => ( {
278
278
name : entry [ 0 ] ,
279
- value : entry [ 1 ] ,
279
+ value : entry [ 1 ] ?? "" ,
280
280
} ) ) ,
281
281
] ,
282
282
runnableArgsProperty : ( runnableArgs : ra . CargoRunnableArgs ) => [
@@ -306,7 +306,7 @@ const knownEngines: {
306
306
307
307
async function getDebugExecutable (
308
308
runnableArgs : ra . CargoRunnableArgs ,
309
- env : Record < string , string > ,
309
+ env : Env ,
310
310
) : Promise < string > {
311
311
const cargo = new Cargo ( runnableArgs . workspaceRoot || "." , env ) ;
312
312
const executable = await cargo . executableFromArgs ( runnableArgs ) ;
@@ -328,7 +328,7 @@ function getDebugConfig(
328
328
runnable : ra . Runnable ,
329
329
runnableArgs : ra . CargoRunnableArgs ,
330
330
executable : string ,
331
- env : Record < string , string > ,
331
+ env : Env ,
332
332
sourceFileMap ?: Record < string , string > ,
333
333
) : vscode . DebugConfiguration {
334
334
const {
@@ -380,14 +380,14 @@ type CodeLldbDebugConfig = {
380
380
args : string [ ] ;
381
381
sourceMap : Record < string , string > | undefined ;
382
382
sourceLanguages : [ "rust" ] ;
383
- env : Record < string , string > ;
383
+ env : Env ;
384
384
} & BaseDebugConfig < "lldb" > ;
385
385
386
386
type NativeDebugConfig = {
387
387
target : string ;
388
388
// See https://github.com/WebFreak001/code-debug/issues/359
389
389
arguments : string ;
390
- env : Record < string , string > ;
390
+ env : Env ;
391
391
valuesFormatting : "prettyPrinters" ;
392
392
} & BaseDebugConfig < "gdb" > ;
393
393
0 commit comments