Code Navigation

Learn how to navigate your code and understand its dependencies with high precision.

Code Navigation helps you quickly understand your code, its dependencies, and symbols within the Sourcegraph file view while making it easier to move through your codebase via:

  • Onboarding to codebases faster with cross-repository code navigation features like Go to definition and Find references
  • Providing complete precise reviews, getting up to speed on unfamiliar code, and determining the impact of code changes with the confidence of compiler-accurate code navigation
  • Determining the root causes quickly with precise code navigation that tracks references across repositories and package dependencies

Try Code Navigation!

See how Code Navigation works on public code.

Enable Code Navigation

Learn how to enable Code Navigation for your code.

Examples

Some common examples of precise navigation.

Indexers

Learn how SCIP Code Intelligence Protocol works and how you can write an indexer to emit SCIP.

Features

Code Navigation helps you with the following tasks:

FeatureDescription
PopoverQuickly view a symbol's type signature and documentation without switching to another source file
Go to definitionClick the button or symbol name, navigates you to the symbol's definition
Find referencesSelecting it in the popover lists all references, definitions, and implementations at the bottom, including precise and search-based results
Dependency navigation (Beta)Extends code navigation to work across packages
Find implementationsClick to go to a symbol's interface definition or, at the interface, see all implementations across repositories, including interfaces implemented by a struct
Perform an actionWhen browsing code, you can perform a couple of actions like open in code host, raw download and view blame.
Read and learn more about Code Navigation features here →

Code Navigation types

There are two types of Code Navigation that Sourcegraph supports:

  • Search-based Code Navigation: Works out of the box with most popular programming languages, powered by Sourcegraph's code search. It uses a mix of text search and syntax-level heuristics (no language-level semantic information) for fast, performant searches across large code bases.
  • Precise Code Navigation: Uses compile-time information to provide users with accurate cross-repository navigation experience across the entire code base.
Previous
Language Reference