sourcegraph / srclib

srclib is a polyglot code analysis library, built for hackability. It consists of language analysis toolchains (currently for Go and Java, with Python, JavaScript, and Ruby in beta) with a common output format, and a CLI tool for running the analysis.
https://srclib.org
Other
942 stars 62 forks source link

Differentiate between types of refs #77

Closed sqs closed 9 years ago

sqs commented 9 years ago

It'd be useful to differentiate between various kinds of refs: refs in imports, refs in type signatures, refs in definitions of things, and refs in code bodies, etc. That's because it's often not useful to see package imports when you want to see how a package is actually used, as in the following example:

image (from https://sourcegraph.com/hg.python.org/cpython@default/.PipPackage/Python/.def/_collections/defaultdict)

There's already a Def bool field on Ref, but perhaps it could be generalized to Type enum that can take values such as def, dep (import), type, etc.

(See also: http://www.mkdown.com/5f7fb62bdaf535ea9f00 by @Wilfred.)

beyang commented 9 years ago

+1

samertm commented 9 years ago

I've added "Local" with https://github.com/sourcegraph/srclib/pull/87, but we can treat Local as an "ignore" option, because it never makes sense to show local vars in search.

sqs commented 9 years ago

This is talking about refs, not defs.

samertm commented 9 years ago

ah, my bad :^)

beyang commented 9 years ago

This enhancement will go hand-in-hand with a broader rethinking of the srclib schema to handle richer def-ref relationships, so closing this.