Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/IBMiContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
33 changes: 28 additions & 5 deletions src/ui/views/environment/environmentView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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 () => {
Expand All @@ -351,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 {
Expand Down
Loading