API docs: LSIF: add basic heuristics for usage examples
Created by: slimsag
For usage examples to be added to API docs, I've encountered two problems:
- The first reference found is often the definition itself, which is definitely useless.
- The other references found are often in the same file as the definition - which don't show usage of the API very effectively.
What I've done here is hacked around the problem a bit by adding some very minimal heuristics that exclude these two types of references in DocumentationReferences
requests.
Longer term, I will make this an option in the GraphQL layer (examples: true
) and begin thinking about how we can apply ranking to usage examples (and, how that should apply to codeintel references more generally - not just in the context of API docs.) -- but for now, this small change means we can start having usage examples on Sourcegraph.com today - which seems a great win.
Signed-off-by: Stephen Gutekanst [email protected]