Skip to content

Commit 3bcfffd

Browse files
author
Tyler Deemer
committed
CSP pages no longer have a loading bar, and after user action console output is not duplicated
1 parent 4e4d67f commit 3bcfffd

File tree

1 file changed

+34
-24
lines changed

1 file changed

+34
-24
lines changed

src/commands/studio.ts

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -215,30 +215,40 @@ class StudioActions {
215215
location: vscode.ProgressLocation.Notification,
216216
title: `Executing user action: ${action.label}`,
217217
},
218-
() =>
219-
this.api
220-
.actionQuery(query, parameters)
221-
.then(async data => {
222-
if(action.save) {
223-
await this.processSaveFlag(action.save);
224-
}
225-
outputConsole(data.console);
226-
return data.result.content.pop();
227-
})
228-
.then(this.processUserAction)
229-
.then(answer => {
230-
if (answer) {
231-
return (answer.msg || answer.msg === "")
232-
? this.userAction(action, true, answer.answer, answer.msg, type)
233-
: this.userAction(action, true, answer, "", type);
234-
}
235-
})
236-
.catch(err => {
237-
console.log(err);
238-
outputChannel.appendLine(`Studio Action "${action.label}" not supported`);
239-
outputChannel.show();
240-
})
241-
);
218+
() => {
219+
return new Promise((resolve) => {
220+
this.api
221+
.actionQuery(query, parameters)
222+
.then(async data => {
223+
if(action.save) {
224+
await this.processSaveFlag(action.save);
225+
}
226+
if(!afterUserAction) {
227+
outputConsole(data.console);
228+
}
229+
const actionToProcess = data.result.content.pop();
230+
231+
// CSP pages should not have a progress bar
232+
if(actionToProcess.action === 2) {
233+
resolve();
234+
}
235+
return actionToProcess;
236+
})
237+
.then(this.processUserAction)
238+
.then(answer => {
239+
if (answer) {
240+
return (answer.msg || answer.msg === "")
241+
? this.userAction(action, true, answer.answer, answer.msg, type)
242+
: this.userAction(action, true, answer, "", type);
243+
}
244+
}).then(() => resolve())
245+
.catch(err => {
246+
console.log(err);
247+
outputChannel.appendLine(`Studio Action "${action.label}" not supported`);
248+
outputChannel.show();
249+
})
250+
});
251+
});
242252
}
243253

244254
private constructMenu(menu, contextOnly = false): any[] {

0 commit comments

Comments
 (0)