PT 168776173 - Progress service improvements in vscode

Fixed a bug and made some improvements in the vscode progress service
such that messages for the same task id can be sent to the same open progress
UI. Previously, the progress UI in vscode will close after the first
message and it was not possible to have a continuous stream
of progress messages appearing in the same open progress UI.
This commit is contained in:
nsingh@pivotal.io
2019-11-14 14:04:59 -08:00
parent e0c637a9e6
commit e01a48b16c

View File

@@ -338,7 +338,8 @@ interface MoveCursorResponse {
}
interface ProgressParams {
id: string
id: string
title: string
statusMsg?: string
}
@@ -367,14 +368,24 @@ class ProgressService {
handle(params: ProgressParams) {
const progressHandler = this.status.get(params.id);
if (progressHandler) {
progressHandler.complete();
if(params.statusMsg) {
progressHandler.updateStatus(params.statusMsg, -1);
} else {
progressHandler.complete();
}
} else {
if (params.statusMsg) {
window.withProgress({
location: ProgressLocation.Notification,
title: params.statusMsg,
title: "",
cancellable: false
}, progress => new Promise(resolve => this.status.set(params.id, new ProgressHandle(progress, resolve))));
}, progress => new Promise(resolve => {
this.status.set(params.id, new ProgressHandle(progress, resolve));
progress.report({
message: params.statusMsg,
increment: -1
})
}));
}
}