src/vs/platform/files/node/watcher/nsfw/nsfwWatcherService.ts/NsfwWatcherService/doWatch
class NsfwWatcherService:	private doWatch(request: IWatcherRequest): void {
		let readyPromiseResolve: (watcher: IWatcher) => void;
		this.pathWatchers[request.path] = {
			ready: new Promise<IWatcher>(resolve => readyPromiseResolve = resolve),
			ignored: Array.isArray(request.excludes) ? request.excludes.map(ignored => parse(ignored)) : []
		};

		// NSFW does not report file changes in the path provided on macOS if
		// - the path uses wrong casing
		// - the path is a symbolic link
		// We have to detect this case and massage the events to correct this.
		let realBasePathDiffers = false;
		let realBasePathLength = request.path.length;
		if (isMacintosh) {
			try {

				// First check for symbolic link
				let realBasePath = realpathSync(request.path);

				// Second check for casing difference
				if (request.path === realBasePath) {
					realBasePath = (realcaseSync(request.path) || request.path);
				}

				if (request.path !== realBasePath) {
					realBasePathLength = realBasePath.length;
					realBasePathDiffers = true;

					this.warn(`Watcher basePath does not match version on disk and will be corrected (original: ${request.path}, real: ${realBasePath})`);
				}
			} catch (error) {
				// ignore
			}
		}

		this.debug(`Start watching with nsfw: ${request.path}`);

		let undeliveredFileEvents: IDiskFileChange[] = [];
		const fileEventDelayer = new ThrottledDelayer<void>(NsfwWatcherService.FS_EVENT_DELAY);

		nsfw(request.path, events => {
			for (const e of events) {

				// Logging
				if (this.verboseLogging) {
					const logPath = e.action === nsfw.actions.RENAMED ? join(e.directory, e.oldFile || '') + ' -> ' + e.newFile : join(e.directory, e.file || '');
					this.log(`${e.action === nsfw.actions.CREATED ? '[CREATED]' : e.action === nsfw.actions.DELETED ? '[DELETED]' : e.action === nsfw.actions.MODIFIED ? '[CHANGED]' : '[RENAMED]'} ${logPath}`);
				}

				// Convert nsfw event to `IRawFileChange` and add to queue
				let absolutePath: string;
				if (e.action === nsfw.actions.RENAMED) {
					absolutePath = join(e.directory, e.oldFile || ''); // Rename fires when a file's name changes within a single directory

					if (!this.isPathIgnored(absolutePath, this.pathWatchers[request.path].ignored)) {
						undeliveredFileEvents.push({ type: FileChangeType.DELETED, path: absolutePath });
					} else if (this.verboseLogging) {
						this.log(` >> ignored ${absolutePath}`);
					}

					absolutePath = join(e.newDirectory || e.directory, e.newFile || '');

					if (!this.isPathIgnored(absolutePath, this.pathWatchers[request.path].ignored)) {
						undeliveredFileEvents.push({ type: FileChangeType.ADDED, path: absolutePath });
					} else if (this.verboseLogging) {
						this.log(` >> ignored ${absolutePath}`);
					}
				} else {
					absolutePath = join(e.directory, e.file || '');

					if (!this.isPathIgnored(absolutePath, this.pathWatchers[request.path].ignored)) {
						undeliveredFileEvents.push({
							type: nsfwActionToRawChangeType[e.action],
							path: absolutePath
						});
					} else if (this.verboseLogging) {
						this.log(` >> ignored ${absolutePath}`);
					}
				}
			}

			// Delay and send buffer
			fileEventDelayer.trigger(async () => {
				const events = undeliveredFileEvents;
				undeliveredFileEvents = [];

				if (isMacintosh) {
					for (const e of events) {

						// Mac uses NFD unicode form on disk, but we want NFC
						e.path = normalizeNFC(e.path);

						// Convert paths back to original form in case it differs
						if (realBasePathDiffers) {
							e.path = request.path + e.path.substr(realBasePathLength);
						}
					}
				}

				// Broadcast to clients normalized
				const normalizedEvents = normalizeFileChanges(events);
				this._onDidChangeFile.fire(normalizedEvents);

				// Logging
				if (this.verboseLogging) {
					for (const e of normalizedEvents) {
						this.log(` >> normalized ${e.type === FileChangeType.ADDED ? '[ADDED]' : e.type === FileChangeType.DELETED ? '[DELETED]' : '[CHANGED]'} ${e.path}`);
					}
				}
			});
		}).then(watcher => {
			this.pathWatchers[request.path].watcher = watcher;
			const startPromise = watcher.start();
			startPromise.then(() => readyPromiseResolve(watcher));

			return startPromise;
		});
	}