What Code Navigation provides
Go to definition
Click any symbol to jump directly to where it is defined, even if the definition lives in a different repository or an external dependency.
Find references
See every location that uses a symbol across all indexed repositories, including both precise and search-based results, in a panel at the bottom of the page.
Hover documentation
Hover over any symbol to see its type signature and inline documentation without leaving the current file.
Find implementations
At an interface definition, see every concrete implementation across repositories. At a struct or class, jump to the interfaces it implements.
- Open in Editor — open the current file in your configured local editor
- View History — see the full commit history for the file
- Blame — show inline blame annotations for every line
- Open in code host — jump to the file on GitHub, GitLab, or Bitbucket
- Permalink — copy a link to the exact line range you are viewing
Precise vs search-based navigation
Sourcegraph supports two navigation modes. Both are available simultaneously — precise results are shown first when available, and search-based results fill in the rest.When a precise index exists for a repository, Sourcegraph automatically uses precise navigation and supplements it with search-based results for any symbols not covered by the index.
Supported languages for precise navigation
Precise Code Navigation is available for the following languages via official SCIP indexers:| Language | Indexer | Cross-repo support |
|---|---|---|
| Go | scip-go | Yes |
| TypeScript / JavaScript | scip-typescript | Yes |
| Python | scip-python | Yes |
| Java | scip-java | Yes |
| Kotlin | scip-java | Yes |
| Scala | scip-java | Yes |
| C / C++ | scip-clang | Yes |
| Rust | rust-analyzer (SCIP mode) | Yes |
| Ruby | scip-ruby | Yes |
Using Code Navigation
In the Sourcegraph web UI
Open any file in Sourcegraph. Hover over a symbol to see its type signature and documentation. From the hover panel you can:- Click Go to definition to navigate to the symbol’s definition
- Click Find references to open the references panel
- Click Find implementations (for interfaces and abstract types)
In VS Code
Install the Sourcegraph VS Code extension to bring Code Navigation into your editor. Once configured with your Sourcegraph instance URL, the extension provides:- Hover documentation for symbols in files you are editing
- Go to definition that can follow imports into external repositories indexed by Sourcegraph
- Find references across your entire connected codebase, not just the local project
Auto-indexing
Auto-indexing automatically generates and uploads SCIP indexes for your repositories on a schedule. Once enabled by a site administrator, Sourcegraph detects the language and build configuration of each repository and runs the appropriate indexer without manual setup. To check whether a repository has a precise index, open a file and hover over a symbol. The hover panel displays a badge indicating whether the result comes from a precise index or search-based heuristics.Auto-indexing requires executors to be configured on your Sourcegraph instance. Ask your site administrator to enable it.
Manually uploading an index
If auto-indexing is not available, you can generate and upload a SCIP index manually using the Sourcegraph CLI:Frequently asked questions
Why do I see multiple results for the same symbol?
Why do I see multiple results for the same symbol?
Search-based navigation can return results from any file containing the symbol name, including files in other repositories where the name is coincidentally the same. Precise navigation only returns results that are semantically connected to the symbol you clicked. If you have precise indexing enabled, precise results appear first and are labeled accordingly.
Find references is truncated at 500 results — what do I do?
Find references is truncated at 500 results — what do I do?
When a symbol has more than 500 references, Sourcegraph truncates the panel to avoid browser performance issues. To see all references, use Code Search with a query targeting the symbol name. This gives you the full filtering and pagination capabilities of search.
How do I know if a repository has precise indexing?
How do I know if a repository has precise indexing?
Open a file in the repository and hover over a symbol. The hover panel displays a label indicating “precise” or “search-based”. You can also check the repository’s indexing status in the site admin panel under Code Intelligence.
Can Code Navigation follow references into third-party packages?
Can Code Navigation follow references into third-party packages?
Does Code Navigation work on pull request diffs?
Does Code Navigation work on pull request diffs?
Related features
Deep Search
Ask natural language questions about your codebase when you need explanation rather than navigation.
Code Search
Find all occurrences of a symbol using structured queries with full filtering capabilities.
Batch Changes
Use precise reference data to confidently make automated changes to every call site of a symbol.
Admin overview
Configure auto-indexing and executors for your Sourcegraph instance.