Refine HCR message (#839)

* Refine HCR message

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>

* Adjust human visible delay

Signed-off-by: Jinbo Wang <jinbwan@microsoft.com>
This commit is contained in:
Jinbo Wang 2020-07-09 16:27:06 +08:00 committed by GitHub
parent 20cd68cbb1
commit 6d61203887
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 1 deletions

View File

@ -184,7 +184,16 @@ async function applyHCR(hcrStatusBar: NotificationBar) {
}
hcrStatusBar.show("$(sync~spin)Applying code changes...");
const start = new Date().getTime();
const response = await debugSession.customRequest("redefineClasses");
const elapsed = new Date().getTime() - start;
const humanVisibleDelay = elapsed < 150 ? 150 : 0;
if (humanVisibleDelay) {
await new Promise((resolve) => {
setTimeout(resolve, humanVisibleDelay);
});
}
if (response && response.errorMessage) {
// The detailed error message is handled by hotCodeReplace#handleHotCodeReplaceCustomEvent
hcrStatusBar.clear();
@ -198,7 +207,7 @@ async function applyHCR(hcrStatusBar: NotificationBar) {
}
const changed = response.changedClasses.length;
hcrStatusBar.show("$(check)" + `${changed} changed class${changed > 1 ? "es are" : " is"} reloaded!`, 5 * 1000);
hcrStatusBar.show("$(check)" + `${changed} changed class${changed > 1 ? "es are" : " is"} reloaded`, 5 * 1000);
}
async function runJavaFile(uri: vscode.Uri, noDebug: boolean) {