Skip to content

Commit 196aeda

Browse files
committed
Fixes microsoft#86165: Do not always cancel the timeout, reduce the delay
1 parent 58bf196 commit 196aeda

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/vs/editor/common/services/modelServiceImpl.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -652,11 +652,15 @@ class ModelSemanticColoring extends Disposable {
652652
this._isDisposed = false;
653653
this._model = model;
654654
this._semanticStyling = stylingProvider;
655-
this._fetchSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchSemanticTokensNow(), 500));
655+
this._fetchSemanticTokens = this._register(new RunOnceScheduler(() => this._fetchSemanticTokensNow(), 300));
656656
this._currentResponse = null;
657657
this._currentRequestCancellationTokenSource = null;
658658

659-
this._register(this._model.onDidChangeContent(e => this._fetchSemanticTokens.schedule()));
659+
this._register(this._model.onDidChangeContent(e => {
660+
if (!this._fetchSemanticTokens.isScheduled()) {
661+
this._fetchSemanticTokens.schedule();
662+
}
663+
}));
660664
this._register(SemanticTokensProviderRegistry.onDidChange(e => this._fetchSemanticTokens.schedule()));
661665
if (themeService) {
662666
// workaround for tests which use undefined... :/
@@ -887,7 +891,9 @@ class ModelSemanticColoring extends Disposable {
887891
}
888892
}
889893

890-
this._fetchSemanticTokens.schedule();
894+
if (!this._fetchSemanticTokens.isScheduled()) {
895+
this._fetchSemanticTokens.schedule();
896+
}
891897
}
892898

893899
this._model.setSemanticTokens(result);

0 commit comments

Comments
 (0)