Navigate your code with tooling that understands it
Code navigation enables developers to explore code by
- jumping to definitions
- finding references
- listing implementations
- browsing symbols defined in current document or folder
- navigate dependencies
- documentation in hover tooltips
Code navigation is made up of multiple features that build on top of each other:
- Search-based code navigation works out of the box with all of the most popular programming languages, powered by Sourcegraph's code search. Our default search-based code navigation uses syntactic-level heuristics (no language-level semantic information) for fast, performant searches across large code bases.
- Precise code navigation powers our code graph by using compile-time information to provide users with an extremely precise and accurate cross-repository1 experience. This means you'll get an accurate view of all symbols and where they are used across your code base.
Precise code navigation requires language-specific indexers to be generated and uploaded to your 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.
Language | Indexer | Status |
---|---|---|
Go | lsif-go | 🟢 Generally available |
TypeScript, JavaScript | scip-typescript | 🟢 Generally available |
C, C++ | scip-clang | 🟡 Partially available |
Java, Kotlin, Scala | scip-java | 🟢 Generally available |
Rust | rust-analyzer | 🟢 Generally available |
Python | scip-python | 🟢 Generally available |
Ruby | scip-ruby | 🟢 Generally available |
C#, Visual Basic | scip-dotnet | 🟡 Partially available |
- Auto-indexing uses Sourcegraph executors to create indexes for the code in your Sourcegraph instance, giving you up-to-date, cross-repository code navigation.
- Beta Dependency navigation allows you to navigate and search through the dependencies of your code, leveraging precise code navigation and auto-indexing.
Here's how you go from search-based code navigation to automatically updating, precise code navigation across multiple repositories and dependencies:
-
Navigate code with search-based code navigation.
-
Start using precise code navigation by creating an index of a repository and uploading it to your Sourcegraph instance:
-
Optionally automate index uploading by adding indexing and uploading to your CI setup.
-
Enable auto-indexing on your Sourcegraph instance to get automatic precise code navigation. Sourcegraph will automatically index your repositories and enable precise code navigation for them.
-
Set up auto-dependency indexing to navigate and search through the dependencies your code uses:
- Go: Enable auto-indexing and Sourcegraph will start indexing your dependencies.
- JavaScript, TypeScript: Enable auto-indexing and set up an npm dependencies code host.
- Java, Scala, Kotlin: Enable auto-indexing and set up a JVM dependencies code host.
Once set up, you can use code navigation with popular development tools:
- In the Sourcegraph web UI
- When browsing code on your code host, via integrations
- While looking at diffs in your code review tool, via integrations
- In the Sourcegraph API
- Introduction to code navigation
- Precise code navigation
- Search-based code navigation
- Code navigation features
- Beta Rockskip: Faster search-based code navigation
- Writing an indexer
- Auto-indexing
- Auto-indexing inference
-
General
-
Language-specific guides
-
Automate uploading code graph data
-
Best practices
- Guide to defining policies as it relates to resource usage
- Requirements
- Troubleshooting
- FAQ
- Sourcegraph-recommended indexers
- Environment variables
- Auto-indexing configuration
Footnotes
-
Supported for any language with a SCIP indexer. ↩