From 4df7571e7f97f9bfa3971326c9ff0ac94197cb26 Mon Sep 17 00:00:00 2001 From: Bob Cozzi Date: Thu, 18 Jun 2026 14:38:17 -0500 Subject: [PATCH 1/2] Add CLPrompter extension integration for library list commands --- src/ui/views/environment/environmentView.ts | 31 ++++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/src/ui/views/environment/environmentView.ts b/src/ui/views/environment/environmentView.ts index d6e16b26c..23a0a8b35 100644 --- a/src/ui/views/environment/environmentView.ts +++ b/src/ui/views/environment/environmentView.ts @@ -320,7 +320,7 @@ export function initializeEnvironmentView(context: vscode.ExtensionContext) { vscode.commands.executeCommand(`code-for-ibmi.refreshIFSBrowser`), vscode.commands.executeCommand(`code-for-ibmi.refreshObjectBrowser`) ]); - environmentView.refresh(); + environmentView.refresh(); if (profile.name && profile.setLibraryListCommand) { await vscode.commands.executeCommand("code-for-ibmi.environment.profile.runLiblistCommand", profile); @@ -339,9 +339,32 @@ export function initializeEnvironmentView(context: vscode.ExtensionContext) { const profile = profileItem && ("profile" in profileItem ? profileItem?.profile : profileItem) || getConnectionProfile(config.get); if (profile?.setLibraryListCommand) { - const command = profile.setLibraryListCommand.startsWith(`?`) ? - await vscode.window.showInputBox({ title: l10n.t(`Run Library List Command`), value: profile.setLibraryListCommand.substring(1) }) : - profile.setLibraryListCommand; + let command: string | undefined; + + if (profile.setLibraryListCommand.startsWith(`?`)) { + // Command starts with '?' - needs prompting + const commandToPrompt = profile.setLibraryListCommand.substring(1); + + // Check if CLPrompter extension is installed + const clPrompterExt = vscode.extensions.getExtension('CozziResearch.clprompter'); + if (clPrompterExt) { + // Use CLPrompter for advanced prompting + if (!clPrompterExt.isActive) { + await clPrompterExt.activate(); + } + const { CLPrompter } = clPrompterExt.exports; + command = await CLPrompter(commandToPrompt, context.extensionUri); + } else { + // Fall back to simple input box + command = await vscode.window.showInputBox({ + title: l10n.t(`Run Library List Command`), + value: commandToPrompt + }); + } + } else { + // No prompting needed + command = profile.setLibraryListCommand; + } if (command) { return await vscode.window.withProgress({ title: l10n.t("Running {0} profile's Library List Command...", profile.name), location: vscode.ProgressLocation.Notification }, async () => { From 14509482415b6d088d3250202dc20fcd1b40049e Mon Sep 17 00:00:00 2001 From: Bob Cozzi Date: Thu, 18 Jun 2026 14:42:48 -0500 Subject: [PATCH 2/2] Fix: missing break in getLibraryListFromCommand causes currentLibrary to be set to '1' The RESULT case in the switch statement was missing a break, causing fall-through into the CURRENT case. When QSYS2.QCMDEXC succeeds it returns '1', so without the break, currentLibrary was set to '1' before being overwritten by the CURRENT row from QSQLIBL(). If the setLibraryListCommand does not change *CURLIB (e.g. IMPLIBL), QSQLIBL() may not return a CURRENT row, leaving currentLibrary='1'. Also guard against overwriting config.currentLibrary with an empty string when the command result does not include a current library entry. Fixes https://github.com/codefori/vscode-ibmi/issues/3295 --- src/api/IBMiContent.ts | 1 + src/ui/views/environment/environmentView.ts | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/api/IBMiContent.ts b/src/api/IBMiContent.ts index a3fef47ab..eaff5e936 100644 --- a/src/api/IBMiContent.ts +++ b/src/api/IBMiContent.ts @@ -1203,6 +1203,7 @@ export default class IBMiContent { if (libraryName !== '1') { throw new Error(`Failed to run Library List Command ${command}`); } + break; case 'CURRENT': result.currentLibrary = libraryName; break; diff --git a/src/ui/views/environment/environmentView.ts b/src/ui/views/environment/environmentView.ts index 23a0a8b35..246dd8760 100644 --- a/src/ui/views/environment/environmentView.ts +++ b/src/ui/views/environment/environmentView.ts @@ -374,7 +374,7 @@ export function initializeEnvironmentView(context: vscode.ExtensionContext) { if (newSettings) { config.libraryList = newSettings.libraryList; - config.currentLibrary = newSettings.currentLibrary; + config.currentLibrary = newSettings.currentLibrary || config.currentLibrary; await IBMi.connectionManager.update(config); await vscode.commands.executeCommand(`code-for-ibmi.refreshLibraryListView`); } else {