Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ export class FileMatchImpl extends Disposable implements ISearchTreeFileMatch {
this.updateHighlights();
}

forceUpdateMatches(): void {
// Cancel any pending scheduled update and run immediately
this._updateScheduler.cancel();
this.updateMatchesForModel();
}

private onModelWillDispose(): void {
// Update matches because model might have some dirty changes
this.updateMatchesForModel();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ export interface ISearchTreeFileMatch {
getSelectedMatch(): ISearchTreeMatch | null;
parent(): ISearchTreeFolderMatch;
bindModel(model: ITextModel): void;
forceUpdateMatches(): void;
hasReadonlyMatches(): boolean;
addContext(results: ITextSearchResult[] | undefined): void;
add(match: ISearchTreeMatch, trigger?: boolean): void;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/

import { Emitter, Event } from '../../../../../base/common/event.js';
import { Event, PauseableEmitter } from '../../../../../base/common/event.js';
import { Disposable } from '../../../../../base/common/lifecycle.js';
import { ResourceMap } from '../../../../../base/common/map.js';
import { TernarySearchTree } from '../../../../../base/common/ternarySearchTree.js';
Expand All @@ -20,7 +20,7 @@ import { isNotebookFileMatch } from '../notebookSearch/notebookSearchModelBase.j


export abstract class TextSearchHeadingImpl<QueryType extends ITextSearchQuery> extends Disposable implements ITextSearchHeading {
protected _onChange = this._register(new Emitter<IChangeEvent>());
protected _onChange = this._register(new PauseableEmitter<IChangeEvent>());
readonly onChange: Event<IChangeEvent> = this._onChange.event;
private _isDirty = false;
private _showHighlights: boolean = false;
Expand Down Expand Up @@ -298,7 +298,12 @@ export class PlainTextSearchHeadingImpl extends TextSearchHeadingImpl<ITextQuery

return promise.then(() => {
this.replacingAll = false;
this.clear();
this._onChange.pause();
try {
this.matches().forEach(fileMatch => fileMatch.forceUpdateMatches());
} finally {
this._onChange.resume();
}
}, () => {
this.replacingAll = false;
});
Expand Down