Precise code intelligence
Precise code intelligence relies onSCIP (SCIP Code Intelligence Protocol) andLSIF(Language Server Index Format) data to deliver precomputed code intelligence. It provides fast and highly accurate code intelligence but needs to be periodically generated and uploaded to your Sourcegraph instance. Precise code intelligence is an opt-in feature: repositories for which you have not uploaded indexes will continue to use the search-based code intelligence.
Getting started
See the how-to guides to get started with precise code intelligence.
Cross-repository code intelligence
Cross-repository code intelligence works out-of-the-box when both the dependent repository and the dependency repository have indexes at the correct commits or versions.We are working on relaxing this constraint so that nearest-commit functionality works on a cross-repository basis as well.
When the current repository has an index and a dependent doesn't,the missing precise results will be supplemented with imprecise search-based code intelligence.This also applies when both repositories have indexes, but for a different set of versions.For example, if repository A@v1 depends on B@v2,then we will get precise cross-repository intelligence when we have indexes for both A@v1 and B@v2,but would not get a precise result we instead have indexes for A@v1 and B@v1.
Why are my results sometimes incorrect?
If an index is not found for a particular file in a repository, Sourcegraph will fall back to search-based code intelligence.You may occasionally see results from search-based code intelligence even when you have uploaded an index.This can happen in the following scenarios:
- The line containing the symbol was created or edited between the nearest indexed commit and the commit being browsed.
- The Find references panel may include search-based results, but only after all of the precise results have been displayed. This ensures every symbol has useful code intelligence.
More about LSIF
To learn more, check out our lightning talk about LSIF from GopherCon 2019 or the introductory blog post: