Precise Code Navigation

Supported on Enterprise plans.

Available via the Web app.

Learn and understand about Precise Code Navigation.

Precise Code Navigation is an opt-in feature that is enabled from your admin settings and requires you to upload indexes for each repository to your Sourcegraph instance. Once setup is complete on Sourcegraph, precise code navigation is available for use across popular development tools:

  • On the Sourcegraph web UI
  • On code files on your code host, via integrations
  • On diffs in your code review tool, via integrations
  • Via the Sourcegraph API

Sourcegraph automatically uses Precise Code Navigation whenever available, and Search-based Code Navigation is used as a fallback when precise navigation is not available.

Precise code navigation relies on the open source SCIP Code Intelligence Protocol, which is a language-agnostic protocol for indexing source code.

Setting up code navigation for your codebase

There are several options for setting up precise code navigation listed below. However, we always recommend you start by manually indexing your repo locally using the approriate indexer for your language. Code and build systems can vary by project and ensuring you can first succesfully run the indexer locally leads to a smoother experience since it is vastly easier to debug and iterate on any issues locally before trying to do so in CI/CD or in Auto-Indexing.
  1. Manual indexing. Index a repository and upload it to your Sourcegraph instance:

  2. Automate indexing via CI: Add indexing and uploading to your CI setup.

  3. Auto-indexing: Sourcegraph will automatically index your repositories and enable precise code navigation for them.

  4. Set up auto-dependency indexing to navigate and search through the dependencies your code uses:

Supported languages and indexers

Precise Code Navigation requires language-specific indexes to be generated and uploaded to your Sourcegraph instance. We currently have precise code navigation support for the languages below. See the indexers page for a detailed breakdown of each indexer's status.

LanguageIndexerStatus
Goscip-go🟒 Generally available
TypeScript, JavaScriptscip-typescript🟒 Generally available
C, C++, CUDAscip-clang🟒 Generally available
Java, Kotlin, Scalascip-java🟒 Generally available
Rustrust-analyzer🟒 Generally available
Pythonscip-python🟒 Generally available
Rubyscip-ruby🟒 Generally available
C#, Visual Basicscip-dotnet🟑 Partially available

The easiest way to configure precise code navigation is with auto-indexing. This feature uses Sourcegraph executors to automatically create indexes for the code, keeping precise code navigation available and up-to-date.

Precise navigation examples

The following repositories have precise code navigation enabled:

More resources

Writing a SCIP indexer

Learn how you can write an indexer to emit SCIP for code navigation in Sourcegraph.

Adding precise code navigation to CI/CD workflows

Learn how to add precise code navigation to CI/CD workflows to Sourcegraph.

Previous
Search-based code navigation