@@ -6,6 +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 { execSync } from 'node:child_process'
910import { execute , isCargoRunnableArgs , unwrapUndefinable } from "./util" ;
1011import type { Config } from "./config" ;
1112
@@ -109,9 +110,9 @@ async function getDebugConfiguration(
109110
110111 await vscode . window . showErrorMessage (
111112 `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.` ,
115116 ) ;
116117 return ;
117118 }
@@ -129,7 +130,7 @@ async function getDebugConfiguration(
129130 ! isMultiFolderWorkspace || ! runnableArgs . workspaceRoot
130131 ? firstWorkspace
131132 : workspaceFolders . find ( ( w ) => runnableArgs . workspaceRoot ?. includes ( w . uri . fsPath ) ) ||
132- firstWorkspace ;
133+ firstWorkspace ;
133134
134135 const workspace = unwrapUndefinable ( maybeWorkspace ) ;
135136 let wsFolder = path . normalize ( workspace . uri . fsPath ) ;
@@ -227,16 +228,25 @@ const knownEngines: {
227228 "ms-vscode.cpptools" : DebugConfigProvider < "cppvsdbg" | "cppdbg" , CCppDebugConfig > ;
228229 "webfreak.debug" : DebugConfigProvider < "gdb" , NativeDebugConfig > ;
229230} = {
230- "llvm-vs-code-extensions.lldb-dap" :{
231+ "llvm-vs-code-extensions.lldb-dap" : {
231232 type : "lldb-dap" ,
232233 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 } ` ) ] ,
234235 runnableArgsProperty : ( runnableArgs : ra . CargoRunnableArgs ) => [
235236 "args" ,
236237 runnableArgs . executableArgs ,
237238 ] ,
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+ } ,
240250 "vadimcn.vscode-lldb" : {
241251 type : "lldb" ,
242252 executableProperty : "program" ,
@@ -353,7 +363,7 @@ type LldbDapDebugConfig = {
353363 program : string ;
354364 args : string [ ] ;
355365 env : string [ ] ;
356- sourceMap : [ string , string ] [ ] ;
366+ sourceMap : [ string , string ] [ ] ;
357367} & BaseDebugConfig < "lldb-dap" > ;
358368
359369
0 commit comments