Code intelligence
Navigate your code with tooling that understands it
Code Intelligence adds advanced code navigation to Sourcegraph, enabling 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 Intelligence is made up of multiple features that build on top of each other:
- Search-based code intelligence works out of the box with all of the most popular programming languages, powered by Sourcegraph's code search and extensions.
- Precise code intelligence uses LSIF indexes to provide correct code intelligence features and accurate cross-repository navigation.
- Auto-indexing uses Sourcegraph executors to create LSIF indexes for the code in your Sourcegraph instance, giving you up-to-date cross-repository code intelligence.
- Dependency navigation allows you to navigate and search through the dependencies of your code, by leveraging precise code intelligence and auto-indexing.
Code Intelligence for your code
Here's how you go from search-based code intelligence to automatically-updating, precise code intelligence across multiple repositories and dependencies:
-
Navigate code with search-based code intelligence and Sourcegraph extensions:
Included in a standard Sourcegraph installation and works out of the box!
-
Start using precise code intelligence by creating an LSIF index of a repository and uploading it to your Sourcegraph instance:
- Index a Go repository
- Index a TypeScript or JavaScript repository
- Index a C++ repository
- Index a Java, Scala & Kotlin repository
See the tutorials for more step-by-step instructions.
-
Optional: automate the uploading of LSIF indexes by adding LSIF indexing and uploading to your CI setup.
-
Get automatic precise code intelligence by enabling auto-indexing which makes Sourcegraph automatically index the your repositories and enable precise code intelligence for them.
-
Setup auto-dependency indexing to navigate and search through the dependencies used by your code:
- Go: Enable auto-indexing and Sourcegraph will start indexing your dependencies.
- Java, Scala, Kotlin: Enable auto-indexing and setup a JVM dependencies code host.
- JavaScript, TypeScript: Enable auto-indexing and setup a npm dependencies code host.
Once setup, code intelligence is available for use across 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
Explanations
- Introduction to code intelligence
- Precise code intelligence
- Search-based code intelligence
- Code navigation features
- Experimental Rockskip: faster search-based code intelligence
- Writing an indexer
- Experimental Auto-indexing
- Experimental Auto-indexing inference
How-tos
- General
- Language-specific guides
- Automate uploading LSIF data
- Add LSIF to many repositories
- Adding LSIF to CI workflows
- Experimental Enable auto-indexing
- Experimental Configure auto-indexing