@@ -3,7 +3,7 @@ import * as vscode from 'vscode';
33import * as path from 'path' ;
44import * as ra from './lsp_ext' ;
55
6- import { Cargo } from './toolchain' ;
6+ import { Cargo , sysrootForDir as getSysroot } from './toolchain' ;
77import { Ctx } from "./ctx" ;
88import { prepareEnv } from "./run" ;
99
@@ -104,7 +104,15 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise<v
104104
105105 const executable = await getDebugExecutable ( runnable ) ;
106106 const env = prepareEnv ( runnable , ctx . config . runnableEnv ) ;
107- const debugConfig = knownEngines [ debugEngine . id ] ( runnable , simplifyPath ( executable ) , env , debugOptions . sourceFileMap ) ;
107+ let sourceFileMap = debugOptions . sourceFileMap ;
108+ if ( ! sourceFileMap || Object . keys ( sourceFileMap ) . length === 0 ) {
109+ // let's try to use the default toolchain
110+ const sysroot = await getSysroot ( wsFolder ) ;
111+ const rustlib_src = path . normalize ( sysroot + "/lib/rustlib/src/rust" ) ;
112+ sourceFileMap = { "/rustc/*" : rustlib_src } ;
113+ }
114+
115+ const debugConfig = knownEngines [ debugEngine . id ] ( runnable , simplifyPath ( executable ) , env , sourceFileMap ) ;
108116 if ( debugConfig . type in debugOptions . engineSettings ) {
109117 const settingsMap = ( debugOptions . engineSettings as any ) [ debugConfig . type ] ;
110118 for ( var key in settingsMap ) {
0 commit comments