Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Commit

Permalink
fix(indexing): Ignorepatterns are applied to node_modules listed in p…
Browse files Browse the repository at this point in the history
…ackage.json


Fixes #274.
  • Loading branch information
asvetliakov authored and buehler committed Sep 8, 2017
1 parent e6e6e79 commit d59db2f
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/extension/extensions/ImportResolveExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,23 +69,28 @@ export async function findFiles(config: ExtensionConfig, rootPath: string): Prom

let globs: string[] = [];
let ignores = ['**/typings/**'];
const excludePatterns = config.resolver.ignorePatterns;

if (rootPath && existsSync(join(rootPath, 'package.json'))) {
const packageJson = require(join(rootPath, 'package.json'));
if (packageJson['dependencies']) {
globs = globs.concat(
Object.keys(packageJson['dependencies']).map(o => `**/node_modules/${o}/**/*.d.ts`),
Object.keys(packageJson['dependencies']).filter(o => excludePatterns.indexOf(o) < 0)
.map(o => `**/node_modules/${o}/**/*.d.ts`),
);
ignores = ignores.concat(
Object.keys(packageJson['dependencies']).map(o => `**/node_modules/${o}/node_modules/**`),
Object.keys(packageJson['dependencies']).filter(o => excludePatterns.indexOf(o) < 0)
.map(o => `**/node_modules/${o}/node_modules/**`),
);
}
if (packageJson['devDependencies']) {
globs = globs.concat(
Object.keys(packageJson['devDependencies']).map(o => `**/node_modules/${o}/**/*.d.ts`),
Object.keys(packageJson['devDependencies']).filter(o => excludePatterns.indexOf(o) < 0)
.map(o => `**/node_modules/${o}/**/*.d.ts`),
);
ignores = ignores.concat(
Object.keys(packageJson['devDependencies']).map(o => `**/node_modules/${o}/node_modules/**`),
Object.keys(packageJson['devDependencies']).filter(o => excludePatterns.indexOf(o) < 0)
.map(o => `**/node_modules/${o}/node_modules/**`),
);
}
} else {
Expand All @@ -101,7 +106,6 @@ export async function findFiles(config: ExtensionConfig, rootPath: string): Prom

let uris = await Promise.all(searches);

const excludePatterns = config.resolver.ignorePatterns;
uris = uris.map((o, idx) => idx === 0 ?
o.filter(
f => f.fsPath
Expand Down

0 comments on commit d59db2f

Please sign in to comment.