Skip to content

Commit

Permalink
fix: Fixed diff gutter cache (close JohnstonCode#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
edgardmessias committed Jun 3, 2019
1 parent 2d0ed55 commit a48cab1
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions src/svnContentProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,30 @@ export class SvnContentProvider
await eventToPromise(onDidFocusWindow);
}

Object.keys(this.cache).forEach(key => {
// Don't check if no has repository changes
if (this.changedRepositoryRoots.size === 0) {
return;
}

// Use copy to allow new items in parallel
const roots = Array.from(this.changedRepositoryRoots);
this.changedRepositoryRoots.clear();

const keys = Object.keys(this.cache);

cacheLoop:
for (const key of keys) {
const uri = this.cache[key].uri;
const fsPath = uri.fsPath;

for (const root of this.changedRepositoryRoots) {
for (const root of roots) {
if (isDescendant(root, fsPath)) {
this._onDidChange.fire(uri);
return;
continue cacheLoop;
}
}
});
}

this.changedRepositoryRoots.clear();
}

public async provideTextDocumentContent(uri: Uri): Promise<string> {
Expand Down

0 comments on commit a48cab1

Please sign in to comment.