From bb9beecbb1fdeb174bdd677482b8e5194d8f58f5 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Tue, 17 Sep 2024 15:30:44 +0200 Subject: [PATCH] watcher - respect workspace settings when resolving `files.watcherExclude` --- .../api/common/extHostFileSystemEventService.ts | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/vs/workbench/api/common/extHostFileSystemEventService.ts b/src/vs/workbench/api/common/extHostFileSystemEventService.ts index 48aea545da0..ff4892239e9 100644 --- a/src/vs/workbench/api/common/extHostFileSystemEventService.ts +++ b/src/vs/workbench/api/common/extHostFileSystemEventService.ts @@ -166,7 +166,8 @@ class FileSystemWatcher implements vscode.FileSystemWatcher { // recursively to give users a chance to configure exclude rules // for reducing the overhead of watching recursively if (recursive && excludes.length === 0) { - const watcherExcludes = configuration.getConfiguration().get('files.watcherExclude'); + const workspaceFolder = workspace.getWorkspaceFolder(URI.revive(globPattern.baseUri)); + const watcherExcludes = configuration.getConfiguration('files', workspaceFolder).get('watcherExclude'); if (watcherExcludes) { for (const key in watcherExcludes) { if (key && watcherExcludes[key] === true) { @@ -188,9 +189,9 @@ class FileSystemWatcher implements vscode.FileSystemWatcher { // `bar` unless a suffix of `/**` if added. // (https://github.com/microsoft/vscode/issues/148245) else if (!recursive) { - const workspaceUri = workspace.getWorkspaceFolder(URI.revive(globPattern.baseUri))?.uri; - if (workspaceUri) { - const watcherExcludes = configuration.getConfiguration().get('files.watcherExclude'); + const workspaceFolder = workspace.getWorkspaceFolder(URI.revive(globPattern.baseUri)); + if (workspaceFolder) { + const watcherExcludes = configuration.getConfiguration('files', workspaceFolder).get('watcherExclude'); if (watcherExcludes) { for (const key in watcherExcludes) { if (key && watcherExcludes[key] === true) { @@ -199,7 +200,7 @@ class FileSystemWatcher implements vscode.FileSystemWatcher { includes = []; } - includes.push(normalizeWatcherPattern(workspaceUri.fsPath, includePattern)); + includes.push(normalizeWatcherPattern(workspaceFolder.uri.fsPath, includePattern)); } } }