Skip to content

Commit

Permalink
Merge pull request #1380 from chrjorgensen/fix/Issue-1290
Browse files Browse the repository at this point in the history
Fix issue #1290
  • Loading branch information
sebjulliand committed Jun 21, 2023
2 parents da5c029 + 60c52ec commit 39c155c
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions src/api/CompileTools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -557,10 +557,19 @@ export namespace CompileTools {
getDefaultVariables(instance, ileSetup)
);

if (commandString.startsWith(`?`)) {
commandString = await vscode.window.showInputBox({ prompt: `Run Command`, value: commandString.substring(1) }) || '';
} else {
commandString = await showCustomInputs(`Run Command`, commandString, title);
if (commandString) {
const commands = commandString.split(`\n`).filter(command => command.trim().length > 0);
const promptedCommands = [];
for (let command of commands) {
if (command.startsWith(`?`)) {
command = await vscode.window.showInputBox({ prompt: `Run Command`, value: command.substring(1) }) || '';
} else {
command = await showCustomInputs(`Run Command`, command, title);
}
promptedCommands.push(command);
if (!command) break;
}
commandString = !promptedCommands.includes(``) ? promptedCommands.join(`\n`) : ``;
}

if (commandString) {
Expand Down Expand Up @@ -670,11 +679,11 @@ export namespace CompileTools {
if (end >= 0) {
let currentInput = command.substring(start + 2, end);

const [name, label, initalValue] = currentInput.split(`|`);
const [name, label, initialValue] = currentInput.split(`|`);
components.push({
name,
label,
initialValue: initalValue || ``,
initialValue: initialValue || ``,
start,
end: end + 1
});
Expand Down Expand Up @@ -710,12 +719,12 @@ export namespace CompileTools {
}
}

commandUI.addButtons({ id: `execute`, label: `Execute` });
commandUI.addButtons({ id: `execute`, label: `Execute` }, { id: `cancel`, label: `Cancel` });

const page = await commandUI.loadPage(name);
const page = await commandUI.loadPage<any>(name);
if (page) {
page.panel.dispose();
if (page.data) {
if (page.data && page.data.buttons !== `cancel`) {
const dataEntries = Object.entries(page.data);
for (const component of components.reverse()) {
const value = dataEntries.find(([key]) => key === component.name)?.[1];
Expand Down

0 comments on commit 39c155c

Please sign in to comment.