Skip to content

Commit

Permalink
Update model correctly with multiple results in one file - #47058
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Apr 20, 2018
1 parent 1fa023b commit db42c90
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/vs/workbench/parts/search/common/searchModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,13 +394,15 @@ export class FolderMatch extends Disposable {
public add(raw: IFileMatch[], silent: boolean): void {
let changed: FileMatch[] = [];
raw.forEach((rawFileMatch) => {
if (!this._fileMatches.has(rawFileMatch.resource)) {
let fileMatch = this.instantiationService.createInstance(FileMatch, this._query.contentPattern, this._query.maxResults, this, rawFileMatch);
this.doAdd(fileMatch);
changed.push(fileMatch);
let disposable = fileMatch.onChange(() => this.onFileChange(fileMatch));
fileMatch.onDispose(() => disposable.dispose());
if (this._fileMatches.has(rawFileMatch.resource)) {
this._fileMatches.get(rawFileMatch.resource).dispose();
}

let fileMatch = this.instantiationService.createInstance(FileMatch, this._query.contentPattern, this._query.maxResults, this, rawFileMatch);
this.doAdd(fileMatch);
changed.push(fileMatch);
let disposable = fileMatch.onChange(() => this.onFileChange(fileMatch));
fileMatch.onDispose(() => disposable.dispose());
});
if (!silent && changed.length) {
this._onChange.fire({ elements: changed, added: true });
Expand Down

0 comments on commit db42c90

Please sign in to comment.