diff --git a/packages/file-service/src/node/disk-file-system.provider.ts b/packages/file-service/src/node/disk-file-system.provider.ts index 43e088c3d2..c8090e0df8 100644 --- a/packages/file-service/src/node/disk-file-system.provider.ts +++ b/packages/file-service/src/node/disk-file-system.provider.ts @@ -102,6 +102,7 @@ export class DiskFileSystemProvider extends RPCService { this.logger.log(events.changes, 'events.change'); if (events.changes.length > 0) { @@ -427,14 +417,22 @@ export class DiskFileSystemProvider extends RPCService { - watcherServer.dispose(); - }, - }); + }; - this._whenReadyDeferred.resolve(); + this.recursiveFileSystemWatcher.setClient(watcherClient); + this.unrecursiveFileSystemWatcher.setClient(watcherClient); + } + + private getWatcherServer(recursive?: boolean) { + const useRecursiveServer = recursive ?? this.recursive; + let watcherServer: FileSystemWatcherServer | UnRecursiveFileSystemWatcher; + this.initWatcherServer(); + + if (useRecursiveServer) { + watcherServer = this.recursiveFileSystemWatcher!; + } else { + watcherServer = this.unrecursiveFileSystemWatcher!; + } return watcherServer; }