1- import { Event , Uri , workspace , EventEmitter } from "vscode" ;
1+ import { Event , Uri , workspace , EventEmitter , RelativePattern } from "vscode" ;
22import { watch } from "fs" ;
33import { exists } from "../fs" ;
4- import { join , resolve } from "path" ;
4+ import { join } from "path" ;
55import { debounce } from "../decorators" ;
6- import { anyEvent , filterEvent , IDisposable , isDescendant } from "../util" ;
6+ import {
7+ anyEvent ,
8+ filterEvent ,
9+ IDisposable ,
10+ isDescendant ,
11+ fixPathSeparator
12+ } from "../util" ;
713
814export class RepositoryFilesWatcher implements IDisposable {
915 private disposables : IDisposable [ ] = [ ] ;
@@ -29,7 +35,7 @@ export class RepositoryFilesWatcher implements IDisposable {
2935
3036 constructor ( readonly root : string ) {
3137 const fsWatcher = workspace . createFileSystemWatcher (
32- join ( resolve ( root ) , "**" )
38+ new RelativePattern ( fixPathSeparator ( root ) , "**" )
3339 ) ;
3440 this . _onRepoChange = new EventEmitter < Uri > ( ) ;
3541 this . _onRepoCreate = new EventEmitter < Uri > ( ) ;
@@ -58,8 +64,7 @@ export class RepositoryFilesWatcher implements IDisposable {
5864
5965 const isTmp = ( uri : Uri ) => / [ \\ \/ ] \. s v n [ \\ \/ ] t m p / . test ( uri . path ) ;
6066
61- const isRelevant = ( uri : Uri ) =>
62- ! isTmp ( uri ) && isDescendant ( this . root , uri . fsPath ) ;
67+ const isRelevant = ( uri : Uri ) => ! isTmp ( uri ) ;
6368
6469 this . onDidChange = filterEvent ( fsWatcher . onDidChange , isRelevant ) ;
6570 this . onDidCreate = filterEvent ( fsWatcher . onDidCreate , isRelevant ) ;
0 commit comments