Bläddra i källkod

Returns disposable

main
Eric Amodio 4 år sedan
förälder
incheckning
f5c351e83e
4 ändrade filer med 19 tillägg och 22 borttagningar
  1. +13
    -11
      src/git/models/repository.ts
  2. +1
    -3
      src/views/nodes/fileHistoryNode.ts
  3. +1
    -3
      src/views/nodes/lineHistoryNode.ts
  4. +4
    -5
      src/views/nodes/repositoryNode.ts

+ 13
- 11
src/git/models/repository.ts Visa fil

@ -726,19 +726,21 @@ export class Repository implements Disposable {
await Container.context.workspaceState.update(WorkspaceState.StarredRepositories, starred);
}
startWatchingFileSystem() {
startWatchingFileSystem() class="o">: Disposable {
this._fsWatchCounter++;
if (this._fsWatcherDisposable != null) return;
if (this._fsWatcherDisposable == null) {
// TODO: createFileSystemWatcher doesn't work unless the folder is part of the workspaceFolders
// https://github.com/Microsoft/vscode/issues/3025
const watcher = workspace.createFileSystemWatcher(new RelativePattern(this.folder, '**'));
this._fsWatcherDisposable = Disposable.from(
watcher,
watcher.onDidChange(this.onFileSystemChanged, this),
watcher.onDidCreate(this.onFileSystemChanged, this),
watcher.onDidDelete(this.onFileSystemChanged, this),
);
}
// TODO: createFileSystemWatcher doesn't work unless the folder is part of the workspaceFolders
// https://github.com/Microsoft/vscode/issues/3025
const watcher = workspace.createFileSystemWatcher(new RelativePattern(this.folder, '**'));
this._fsWatcherDisposable = Disposable.from(
watcher,
watcher.onDidChange(this.onFileSystemChanged, this),
watcher.onDidCreate(this.onFileSystemChanged, this),
watcher.onDidDelete(this.onFileSystemChanged, this),
);
return { dispose: () => this.stopWatchingFileSystem() };
}
stopWatchingFileSystem() {

+ 1
- 3
src/views/nodes/fileHistoryNode.ts Visa fil

@ -132,11 +132,9 @@ export class FileHistoryNode extends SubscribeableViewNode implements PageableVi
const subscription = Disposable.from(
repo.onDidChange(this.onRepoChanged, this),
repo.onDidChangeFileSystem(this.onRepoFileSystemChanged, this),
{ dispose: () => repo.stopWatchingFileSystem() },
repo.startWatchingFileSystem(),
);
repo.startWatchingFileSystem();
return subscription;
}

+ 1
- 3
src/views/nodes/lineHistoryNode.ts Visa fil

@ -262,11 +262,9 @@ export class LineHistoryNode extends SubscribeableViewNode implements PageableVi
const subscription = Disposable.from(
repo.onDidChange(this.onRepoChanged, this),
repo.onDidChangeFileSystem(this.onRepoFileSystemChanged, this),
{ dispose: () => repo.stopWatchingFileSystem() },
repo.startWatchingFileSystem(),
);
repo.startWatchingFileSystem();
return subscription;
}

+ 4
- 5
src/views/nodes/repositoryNode.ts Visa fil

@ -248,11 +248,10 @@ export class RepositoryNode extends SubscribeableViewNode {
// }
if (this.includeWorkingTree) {
disposables.push(this.repo.onDidChangeFileSystem(this.onFileSystemChanged, this), {
dispose: () => this.repo.stopWatchingFileSystem(),
});
this.repo.startWatchingFileSystem();
disposables.push(
this.repo.onDidChangeFileSystem(this.onFileSystemChanged, this),
this.repo.startWatchingFileSystem(),
);
}
return Disposable.from(...disposables);

Laddar…
Avbryt
Spara