From 16c7f54aa3c2158cd13e00906f84159801aa93ff Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Thu, 13 Apr 2017 12:39:47 +0200 Subject: [PATCH 1/2] Filter references from node_modules --- src/typescript-service.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/typescript-service.ts b/src/typescript-service.ts index 777b15bce..227297651 100644 --- a/src/typescript-service.ts +++ b/src/typescript-service.ts @@ -335,8 +335,12 @@ export class TypeScriptService { // Request references at position from TypeScript // Despite the signature, getReferencesAtPosition() can return undefined return Observable.from(configuration.getService().getReferencesAtPosition(fileName, offset) || []) - // Filter declaration if not requested - .filter(reference => !reference.isDefinition || (params.context && params.context.includeDeclaration)) + .filter(reference => + // Filter declaration if not requested + (!reference.isDefinition || (params.context && params.context.includeDeclaration)) + // Filter references in node_modules + && !reference.fileName.includes('/node_modules/') + ) // Map to Locations .map(reference => { const sourceFile = configuration.getProgram().getSourceFile(reference.fileName); From 1297ba5f622df17c67f5cc0ced7505617a76c958 Mon Sep 17 00:00:00 2001 From: Felix Becker Date: Thu, 13 Apr 2017 14:55:46 +0200 Subject: [PATCH 2/2] Add comment --- src/typescript-service.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/typescript-service.ts b/src/typescript-service.ts index 227297651..59572b97b 100644 --- a/src/typescript-service.ts +++ b/src/typescript-service.ts @@ -314,6 +314,8 @@ export class TypeScriptService { /** * The references request is sent from the client to the server to resolve project-wide * references for the symbol denoted by the given text document position. + * + * Returns all references to the symbol at the position in the own workspace, including references inside node_modules. */ textDocumentReferences(params: ReferenceParams, span = new Span()): Observable { // Ensure all files were fetched to collect all references