watch

Subscribes to file change events in the file or folder denoted by uri. For folders, the option recursive indicates whether subfolders, sub-subfolders, etc. should be watched for file changes as well. With recursive: false, only changes to the files that are direct children of the folder should trigger an event.

The excludes array is used to indicate paths that should be excluded from file watching. It is typically derived from the files.watcherExclude setting that is configurable by the user. Each entry can be be:

  • the absolute path to exclude

  • a relative path to exclude (for example build/output)

  • a simple glob pattern (for example **​/build, output/​**)

It is the file system provider's job to call {@linkcode FileSystemProvider.onDidChangeFile onDidChangeFile} for every change given these rules. No event should be emitted for files that match any of the provided excludes.

Parameters

uri

The uri of the file or folder to be watched.

options

Configures the watch.