From 5aa31432cf3e9cccd95268ba8f2d5d7d9fa4034a Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Mills Date: Wed, 24 May 2023 19:03:17 -1000 Subject: [PATCH] simplify logic --- .../vscode/src/plugins/prisma-language-server/index.ts | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/vscode/src/plugins/prisma-language-server/index.ts b/packages/vscode/src/plugins/prisma-language-server/index.ts index 84f17b0cb2..35955ca246 100644 --- a/packages/vscode/src/plugins/prisma-language-server/index.ts +++ b/packages/vscode/src/plugins/prisma-language-server/index.ts @@ -93,14 +93,8 @@ const startFileWatcher = (rootPath: string) => { if (!targetPath.startsWith(rootPath)) return true if (targetPath.endsWith('.git')) return true - // for all the sub-directories of the project, allow recursion into node_modules - if (fs.statSync(targetPath).isDirectory() && !targetPath.includes('node_modules')) { - allowedWatcherPaths[path.join(targetPath, 'node_modules')] = true - return false - } - - // but every time we hit a project path, we ensure some sub-paths are whitelisted - if (fs.statSync(targetPath).isDirectory()) { + // every time we hit a project path, ensure some sub-paths are whitelisted + if (!(targetPath in allowedWatcherPaths) && fs.statSync(targetPath).isDirectory()) { try { // we get the location of installation of the @prisma/client package const clientPath = path.dirname(require.resolve('@prisma/client', { paths: [targetPath] }))