Skip to content

Commit 6d61203

Browse files
Refine HCR message (#839)
* Refine HCR message Signed-off-by: Jinbo Wang <[email protected]> * Adjust human visible delay Signed-off-by: Jinbo Wang <[email protected]>
1 parent 20cd68c commit 6d61203

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/extension.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,16 @@ async function applyHCR(hcrStatusBar: NotificationBar) {
184184
}
185185

186186
hcrStatusBar.show("$(sync~spin)Applying code changes...");
187+
const start = new Date().getTime();
187188
const response = await debugSession.customRequest("redefineClasses");
189+
const elapsed = new Date().getTime() - start;
190+
const humanVisibleDelay = elapsed < 150 ? 150 : 0;
191+
if (humanVisibleDelay) {
192+
await new Promise((resolve) => {
193+
setTimeout(resolve, humanVisibleDelay);
194+
});
195+
}
196+
188197
if (response && response.errorMessage) {
189198
// The detailed error message is handled by hotCodeReplace#handleHotCodeReplaceCustomEvent
190199
hcrStatusBar.clear();
@@ -198,7 +207,7 @@ async function applyHCR(hcrStatusBar: NotificationBar) {
198207
}
199208

200209
const changed = response.changedClasses.length;
201-
hcrStatusBar.show("$(check)" + `${changed} changed class${changed > 1 ? "es are" : " is"} reloaded!`, 5 * 1000);
210+
hcrStatusBar.show("$(check)" + `${changed} changed class${changed > 1 ? "es are" : " is"} reloaded`, 5 * 1000);
202211
}
203212

204213
async function runJavaFile(uri: vscode.Uri, noDebug: boolean) {

0 commit comments

Comments
 (0)