@@ -3,7 +3,7 @@ import * as vscode from "vscode";
33import * as path from "path" ;
44import type * as ra from "./lsp_ext" ;
55
6- import { Cargo , type ExecutableInfo , getRustcId , getSysroot } from "./toolchain" ;
6+ import { Cargo , getRustcId , getSysroot } from "./toolchain" ;
77import type { Ctx } from "./ctx" ;
88import { prepareEnv } from "./run" ;
99import { unwrapUndefinable } from "./undefinable" ;
@@ -12,7 +12,6 @@ const debugOutput = vscode.window.createOutputChannel("Debug");
1212type DebugConfigProvider = (
1313config :ra . Runnable ,
1414executable :string ,
15- cargoWorkspace :string ,
1615env :Record < string , string > ,
1716sourceFileMap ?:Record < string , string > ,
1817) => vscode . DebugConfiguration ;
@@ -134,7 +133,7 @@ async function getDebugConfiguration(
134133}
135134
136135const env = prepareEnv ( runnable , ctx . config . runnablesExtraEnv ) ;
137- const { executable, workspace : cargoWorkspace } = await getDebugExecutableInfo ( runnable , env ) ;
136+ const executable = await getDebugExecutable ( runnable , env ) ;
138137let sourceFileMap = debugOptions . sourceFileMap ;
139138if ( sourceFileMap === "auto" ) {
140139// let's try to use the default toolchain
@@ -148,13 +147,7 @@ async function getDebugConfiguration(
148147}
149148
150149const provider = unwrapUndefinable ( knownEngines [ debugEngine . id ] ) ;
151- const debugConfig = provider (
152- runnable ,
153- simplifyPath ( executable ) ,
154- cargoWorkspace ,
155- env ,
156- sourceFileMap ,
157- ) ;
150+ const debugConfig = provider ( runnable , simplifyPath ( executable ) , env , sourceFileMap ) ;
158151if ( debugConfig . type in debugOptions . engineSettings ) {
159152const settingsMap = ( debugOptions . engineSettings as any ) [ debugConfig . type ] ;
160153for ( var key in settingsMap ) {
@@ -176,21 +169,20 @@ async function getDebugConfiguration(
176169return debugConfig ;
177170}
178171
179- async function getDebugExecutableInfo (
172+ async function getDebugExecutable (
180173runnable :ra . Runnable ,
181174env :Record < string , string > ,
182- ) :Promise < ExecutableInfo > {
175+ ) :Promise < string > {
183176const cargo = new Cargo ( runnable . args . workspaceRoot || "." , debugOutput , env ) ;
184- const executableInfo = await cargo . executableInfoFromArgs ( runnable . args . cargoArgs ) ;
177+ const executable = await cargo . executableFromArgs ( runnable . args . cargoArgs ) ;
185178
186179// if we are here, there were no compilation errors.
187- return executableInfo ;
180+ return executable ;
188181}
189182
190183function getCCppDebugConfig (
191184runnable :ra . Runnable ,
192185executable :string ,
193- cargoWorkspace :string ,
194186env :Record < string , string > ,
195187sourceFileMap ?:Record < string , string > ,
196188) :vscode . DebugConfiguration {
@@ -200,7 +192,7 @@ function getCCppDebugConfig(
200192name :runnable . label ,
201193program :executable ,
202194args :runnable . args . executableArgs ,
203- cwd :cargoWorkspace || runnable . args . workspaceRoot ,
195+ cwd :runnable . args . workspaceRoot ,
204196 sourceFileMap,
205197 env,
206198// See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941
@@ -213,7 +205,6 @@ function getCCppDebugConfig(
213205function getCodeLldbDebugConfig (
214206runnable :ra . Runnable ,
215207executable :string ,
216- cargoWorkspace :string ,
217208env :Record < string , string > ,
218209sourceFileMap ?:Record < string , string > ,
219210) :vscode . DebugConfiguration {
@@ -223,7 +214,7 @@ function getCodeLldbDebugConfig(
223214name :runnable . label ,
224215program :executable ,
225216args :runnable . args . executableArgs ,
226- cwd :cargoWorkspace || runnable . args . workspaceRoot ,
217+ cwd :runnable . args . workspaceRoot ,
227218sourceMap :sourceFileMap ,
228219sourceLanguages :[ "rust" ] ,
229220 env,
@@ -233,7 +224,6 @@ function getCodeLldbDebugConfig(
233224function getNativeDebugConfig (
234225runnable :ra . Runnable ,
235226executable :string ,
236- cargoWorkspace :string ,
237227env :Record < string , string > ,
238228_sourceFileMap ?:Record < string , string > ,
239229) :vscode . DebugConfiguration {
@@ -244,7 +234,7 @@ function getNativeDebugConfig(
244234target :executable ,
245235// See https://github.com/WebFreak001/code-debug/issues/359
246236arguments :quote ( runnable . args . executableArgs ) ,
247- cwd :cargoWorkspace || runnable . args . workspaceRoot ,
237+ cwd :runnable . args . workspaceRoot ,
248238 env,
249239valuesFormatting :"prettyPrinters" ,
250240} ;