@@ -6,6 +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 { execSync } from 'node:child_process'
9
10
import { execute , isCargoRunnableArgs , unwrapUndefinable } from "./util" ;
10
11
import type { Config } from "./config" ;
11
12
@@ -109,9 +110,9 @@ async function getDebugConfiguration(
109
110
110
111
await vscode . window . showErrorMessage (
111
112
`Install [CodeLLDB](command:${ commandCodeLLDB } "Open CodeLLDB")` +
112
- `, [lldb-dap](command:${ commandLLDBDap } "Open lldb-dap")` +
113
- `, [C/C++](command:${ commandCCpp } "Open C/C++") ` +
114
- `or [Native Debug](command:${ commandNativeDebug } "Open Native Debug") for debugging.` ,
113
+ `, [lldb-dap](command:${ commandLLDBDap } "Open lldb-dap")` +
114
+ `, [C/C++](command:${ commandCCpp } "Open C/C++") ` +
115
+ `or [Native Debug](command:${ commandNativeDebug } "Open Native Debug") for debugging.` ,
115
116
) ;
116
117
return ;
117
118
}
@@ -129,7 +130,7 @@ async function getDebugConfiguration(
129
130
! isMultiFolderWorkspace || ! runnableArgs . workspaceRoot
130
131
? firstWorkspace
131
132
: workspaceFolders . find ( ( w ) => runnableArgs . workspaceRoot ?. includes ( w . uri . fsPath ) ) ||
132
- firstWorkspace ;
133
+ firstWorkspace ;
133
134
134
135
const workspace = unwrapUndefinable ( maybeWorkspace ) ;
135
136
let wsFolder = path . normalize ( workspace . uri . fsPath ) ;
@@ -227,16 +228,25 @@ const knownEngines: {
227
228
"ms-vscode.cpptools" : DebugConfigProvider < "cppvsdbg" | "cppdbg" , CCppDebugConfig > ;
228
229
"webfreak.debug" : DebugConfigProvider < "gdb" , NativeDebugConfig > ;
229
230
} = {
230
- "llvm-vs-code-extensions.lldb-dap" :{
231
+ "llvm-vs-code-extensions.lldb-dap" : {
231
232
type : "lldb-dap" ,
232
233
executableProperty : "program" ,
233
- environmentProperty : ( env ) => [ "env" , Object . entries ( env ) . map ( ( [ k , v ] ) => `${ k } =${ v } ` ) ] ,
234
+ environmentProperty : ( env ) => [ "env" , Object . entries ( env ) . map ( ( [ k , v ] ) => `${ k } =${ v } ` ) ] ,
234
235
runnableArgsProperty : ( runnableArgs : ra . CargoRunnableArgs ) => [
235
236
"args" ,
236
237
runnableArgs . executableArgs ,
237
238
] ,
238
-
239
- } ,
239
+ additional : {
240
+ "sourceMap" : [
241
+ [
242
+ `/rustc/${ / c o m m i t - h a s h : \s ( .* ) $ / m. exec ( execSync ( "rustc -V -v" , { } ) . toString ( ) ) ?. [ 1 ]
243
+ } /library`,
244
+ "${config:rust-analyzer.cargo.sysroot}/lib/rustlib/src/rust/library"
245
+
246
+ ]
247
+ ]
248
+ }
249
+ } ,
240
250
"vadimcn.vscode-lldb" : {
241
251
type : "lldb" ,
242
252
executableProperty : "program" ,
@@ -353,7 +363,7 @@ type LldbDapDebugConfig = {
353
363
program : string ;
354
364
args : string [ ] ;
355
365
env : string [ ] ;
356
- sourceMap : [ string , string ] [ ] ;
366
+ sourceMap : [ string , string ] [ ] ;
357
367
} & BaseDebugConfig < "lldb-dap" > ;
358
368
359
369
0 commit comments