From 82f9e74e145c0fd4d925283fe59322ce7f6537e7 Mon Sep 17 00:00:00 2001 From: Chris Wendt Date: Sat, 16 Mar 2019 23:37:30 -0700 Subject: [PATCH] Filter by fileLocal --- package/src/handler.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/package/src/handler.ts b/package/src/handler.ts index 7d503564d..654325614 100644 --- a/package/src/handler.ts +++ b/package/src/handler.ts @@ -628,10 +628,22 @@ export class Handler { this.sourcegraph.internal.sourcegraphURL.href === 'https://sourcegraph.com/', })) { - const symbolResults = (await this.api.search({ query })).map( - result => + const symbolResults = (await this.api.search({ + query, + fileLocal: Boolean( + this.sourcegraph.configuration + .get() + .get('feature.fileLocal') + ), + })) + .filter( + result => + !result.fileLocal || + result.file === new URL(doc.uri).hash.replace(/^#/, '') + ) + .map(result => resultToLocation({ result, sourcegraph: this.sourcegraph }) - ) + ) if (symbolResults.length > 0) { return sortByProximity({