Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
millsp committed May 25, 2023
1 parent ea7b833 commit 5aa3143
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions packages/vscode/src/plugins/prisma-language-server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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] }))
Expand Down

0 comments on commit 5aa3143

Please sign in to comment.