From 33741c26479a065aa2e96e8187090d5ec272e61c Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 30 Mar 2026 19:03:46 +0200 Subject: [PATCH] Default files.watcherExclude patterns cause CPU stall on large repos due to pathological regex (fix #305923) (#306224) --- .../browser/configuration.contribution.ts | 6 ------ .../contrib/files/browser/files.contribution.ts | 11 ++++++++++- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/vs/sessions/contrib/configuration/browser/configuration.contribution.ts b/src/vs/sessions/contrib/configuration/browser/configuration.contribution.ts index ab58adf1c9b..9852a3a9b3f 100644 --- a/src/vs/sessions/contrib/configuration/browser/configuration.contribution.ts +++ b/src/vs/sessions/contrib/configuration/browser/configuration.contribution.ts @@ -29,12 +29,6 @@ Registry.as(Extensions.Configuration).registerDefaultCon 'extensions.ignoreRecommendations': true, 'files.autoSave': 'afterDelay', - 'files.watcherExclude': { - '**/.git/objects/**': true, - '**/.git/subtree-cache/**': true, - '**/node_modules/*/**': true, - '**/.hg/store/**': true - }, 'git.autofetch': true, 'git.branchRandomName.enable': true, diff --git a/src/vs/workbench/contrib/files/browser/files.contribution.ts b/src/vs/workbench/contrib/files/browser/files.contribution.ts index 8f36c834a3a..c0b8db32da0 100644 --- a/src/vs/workbench/contrib/files/browser/files.contribution.ts +++ b/src/vs/workbench/contrib/files/browser/files.contribution.ts @@ -295,7 +295,16 @@ configurationRegistry.registerConfiguration({ 'patternProperties': { '.*': { 'type': 'boolean' } }, - 'default': { '**/.git/objects/**': true, '**/.git/subtree-cache/**': true, '**/.hg/store/**': true }, + 'default': { + // Avoiding a '**' pattern here which results in a very complex + // RegExp that can slow things down significantly in large workspaces + '.git/objects/**': true, + '.git/subtree-cache/**': true, + '.hg/store/**': true, + '*/.git/objects/**': true, + '*/.git/subtree-cache/**': true, + '*/.hg/store/**': true + }, 'markdownDescription': nls.localize('watcherExclude', "Configure paths or [glob patterns](https://aka.ms/vscode-glob-patterns) to exclude from file watching. Paths can either be relative to the watched folder or absolute. Glob patterns are matched relative from the watched folder. When you experience the file watcher process consuming a lot of CPU, make sure to exclude large folders that are of less interest (such as build output folders)."), 'scope': ConfigurationScope.RESOURCE },