Add watcher to refresh on file system changes

[?]
Dec 28, 2020, 12:19 AM
WHQQV5QQHLUK5F6TXIDMPKI73E5FLCEWAUAAW3PGI2E6TPVQJVYAC

Dependencies

  • [2] MU6ZNUYZ Integrate recordAll command with input box
  • [3] YUVLBWV3 Populate resource groups for unrecorded and untracked changes
  • [4] B4SKYP3Y Add repository model and add steps to initialize it

Change contents

  • replacement in src/repository.ts at line 1
    [3.16][2.0:113]()
    import { Disposable, OutputChannel, scm, SourceControl, SourceControlResourceGroup, Uri, window } from 'vscode';
    [3.16]
    [3.122]
    import { Disposable, Event, OutputChannel, RelativePattern, scm, SourceControl, SourceControlResourceGroup, Uri, window, workspace } from 'vscode';
  • edit in src/repository.ts at line 4
    [3.229]
    [3.229]
    import { anyEvent } from './utils/eventUtils';
  • edit in src/repository.ts at line 12
    [3.482]
    [3.482]
    public onDidChange: Event<Uri>;
    public onDidCreate: Event<Uri>;
    public onDidDelete: Event<Uri>;
    public onDidAny: Event<Uri>;
  • edit in src/repository.ts at line 44
    [3.1472]
    [3.1472]
    // Setup watchers
    const fsWatcher = workspace.createFileSystemWatcher(
    new RelativePattern(root, '**')
    );
  • edit in src/repository.ts at line 50
    [3.1473]
    [3.1473]
    this.onDidChange = fsWatcher.onDidChange;
    this.onDidCreate = fsWatcher.onDidCreate;
    this.onDidDelete = fsWatcher.onDidDelete;
    this.onDidAny = anyEvent(
    this.onDidChange,
    this.onDidCreate,
    this.onDidDelete
    );
    this.onDidAny(this.onAnyRepositoryFileChange, this, this.disposables);
  • edit in src/repository.ts at line 67
    [3.1517]
    [3.1517]
    async onAnyRepositoryFileChange (): Promise<void> {
    this.refreshStatus();
    }
  • edit in src/repository.ts at line 74
    [3.163][3.163:168](),[3.168][3.168:236]()
    *
    * TODO: Refresh automatically when files in the workspace change