diff --git a/src/api.ts b/src/api.ts index 03326eaa..921ea323 100644 --- a/src/api.ts +++ b/src/api.ts @@ -370,8 +370,12 @@ export class MirrordAPI { * setting env vars, both from system, and from `launch.json` (`configEnv`). * * Has 60 seconds timeout + * + * @param quickPickSelection target selected by the user from the quick pick widget. + * `undefined` if we found the target in the config, + * and the widget was not shown. */ - async binaryExecute(target: UserSelection | undefined, configFile: string | null, executable: string | null, configEnv: EnvVars): Promise { + async binaryExecute(quickPickSelection: UserSelection | undefined, configFile: string | null, executable: string | null, configEnv: EnvVars): Promise { tickMirrordForTeamsCounter(); tickFeedbackCounter(); tickDiscordCounter(); @@ -387,11 +391,11 @@ export class MirrordAPI { reject("timeout"); }, 120 * 1000); - const args = makeMirrordArgs(target?.path, configFile, executable); + const args = makeMirrordArgs(quickPickSelection?.path, configFile, executable); let env: EnvVars; - if (target?.namespace) { + if (quickPickSelection?.namespace) { // eslint-disable-next-line @typescript-eslint/naming-convention - env = { MIRRORD_TARGET_NAMESPACE: target.namespace, ...configEnv }; + env = { MIRRORD_TARGET_NAMESPACE: quickPickSelection.namespace, ...configEnv }; } else { env = configEnv; } diff --git a/src/debugger.ts b/src/debugger.ts index 2a33f359..ea413330 100644 --- a/src/debugger.ts +++ b/src/debugger.ts @@ -110,7 +110,7 @@ async function main( let mirrordApi = new MirrordAPI(cliPath); config.env ||= {}; - let target: UserSelection | undefined = undefined; + let quickPickSelection: UserSelection | undefined = undefined; let configPath = await MirrordConfigManager.getInstance().resolveMirrordConfig(folder, config); const verifiedConfig = await mirrordApi.verifyConfig(configPath, config.env); @@ -123,7 +123,7 @@ async function main( try { const quickPick = await TargetQuickPick.new(getTargets); - target = await quickPick.showAndGet(); + quickPickSelection = await quickPick.showAndGet(); } catch (err) { mirrordFailure(`mirrord failed to list targets: ${err}`); return null; @@ -152,7 +152,7 @@ async function main( let executionInfo; try { - executionInfo = await mirrordApi.binaryExecute(target, configPath?.path || null, executable, config.env); + executionInfo = await mirrordApi.binaryExecute(quickPickSelection, configPath?.path || null, executable, config.env); } catch (err) { mirrordFailure(`mirrord preparation failed: ${err}`); return null;