Skip to content

Commit a9be733

Browse files
authored
Delay notifications for 2s before displaying (#16638)
1 parent 40d19e6 commit a9be733

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/platform/progress/kernelProgressReporter.ts

+10-3
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { inject, injectable } from 'inversify';
55
import { CancellationToken, Disposable, Progress, ProgressLocation, window } from 'vscode';
66
import { IExtensionSyncActivationService } from '../activation/types';
77
import { raceCancellation } from '../common/cancellation';
8-
import { dispose } from '../common/utils/lifecycle';
8+
import { DisposableStore, dispose } from '../common/utils/lifecycle';
99
import { IDisposable, IDisposableRegistry, Resource } from '../common/types';
1010
import { createDeferred } from '../common/utils/async';
1111
import { noop } from '../common/utils/misc';
@@ -86,8 +86,15 @@ export class KernelProgressReporter implements IExtensionSyncActivationService {
8686
if (!KernelProgressReporter.instance) {
8787
return cb();
8888
}
89-
const progress = KernelProgressReporter.reportProgressInternal(key, title);
90-
return cb().finally(() => progress?.dispose());
89+
const store = new DisposableStore();
90+
// Always wait 2s before showing any progress reporter (else we end up with too much noise).
91+
const timeout = setTimeout(() => {
92+
if (!store.isDisposed) {
93+
store.add(KernelProgressReporter.reportProgressInternal(key, title));
94+
}
95+
}, 2_000);
96+
store.add(new Disposable(() => clearTimeout(timeout)));
97+
return cb().finally(() => store.dispose());
9198
}
9299

93100
/**

0 commit comments

Comments
 (0)