@kkdev92/vscode-ext-kit - v4.1.1
    Preparing search index...

    Interface FileWatcherService

    Watching a path chosen while the extension is running.

    Distinct from module.fileWatchers.add, which declares the globs an extension always watches — those are bound at activation, run their handler in an operation, and are torn down with the module. This is the other case: the user picks a log file or types a glob, and the watcher exists only for as long as that choice does. Declaring it is impossible, because the pattern is not known until the user says so.

    Prefer the declaration whenever the pattern is known up front — it comes with the operation context, the diagnostics and the ownership for free.

    module.commands.handle(Tail, {
    inject: { watchers: FileWatchers },
    execute: async (context, [pattern], { watchers }) => {
    const watcher = watchers.watch({ patterns: pattern, debounceDelay: 500 });
    // Released when the command's scope unwinds; the service would release
    // it at shutdown regardless.
    context.resources.own(watcher);
    watcher.onDidChange((events) => view.refresh(events));
    },
    });
    interface FileWatcherService {
        watch(options: FileWatcherOptions): ManagedFileWatcher;
    }
    Index