Skip to content
This repository was archived by the owner on Feb 22, 2020. It is now read-only.

Conversation

@chrismwendt
Copy link
Contributor

@chrismwendt chrismwendt commented Mar 21, 2019

This uses a regex to find import statements and omits symbol search results that are defined in files that are not imported. Example https://sourcegraph.com/github.com/sourcegraph/sourcegraph@master/-/blob/cmd/frontend/db/repos.go#L47:65&tab=def

image

Here's an example where this technique successfully filtered down from ~20 results to a single unique result https://sourcegraph.com/github.com/sourcegraph/sourcegraph@7e72cbf659b10f613acdd22963447e47f174138b/-/blob/cmd/frontend/registry/extensions.go#L219:22

image

Where this breaks: if the real definition of the token is in a transitively imported package, this will incorrectly omit the result from the list unless there were no results in imported packages. One way to solve that is to walk the imports, but that would be quite slow. Maybe we can index the set of transitive imports somehow so that lookups are fast.

@chrismwendt chrismwendt merged commit 42624aa into master Mar 21, 2019
@chrismwendt chrismwendt deleted the filter-definitions branch March 21, 2019 05:03
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants