
# Code Navigation

<p className="subtitle">
	Learn how to navigate your code and understand its dependencies with high
	precision.
</p>

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](/code-navigation/features#go-to-definition) and [Find references](/code-navigation/features#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

<video
	width="1920"
	height="1080"
	loop
	playsInline
	controls
	style={{width: '100%', height: 'auto'}}
>
	<source
		src="https://storage.googleapis.com/sourcegraph-assets/Docs/Media/code-navigation.webm"
		type="video/webm"
	/>
</video>

## Quicklinks

<QuickLinks>
	<QuickLink
		href="https://sourcegraph.com/github.com/sourcegraph/conc@v0.3.0/-/blob/pool/pool.go?L30:6-30:10#tab=references"
		icon="installation"
		imgAlt="Code Navigation"
		title="Try Code Navigation!"
		description="See how Code Navigation works on public code."
	/>
	<QuickLink
		href="/code-navigation/precise-code-navigation#setting-up-code-navigation-for-your-codebase"
		icon="lightbulb"
		imgAlt="Code Navigation"
		title="Enable Code Navigation"
		description="Learn how to enable Code Navigation for your code."
	/>
	<QuickLink
		href="/code-navigation/precise-code-navigation#precise-navigation-examples"
		icon="presets"
		imgAlt="Code Navigation"
		title="Examples"
		description="Some common examples of precise navigation."
	/>
	<QuickLink
		href="/code-navigation/writing-an-indexer#writing-an-indexer"
		icon="theming"
		imgAlt="Code Navigation"
		title="Indexers"
		description="Learn how SCIP Code Intelligence Protocol works and how you can write an indexer to emit SCIP."
	/>
</QuickLinks>

## Features

Code Navigation helps you with the following tasks:

| **Feature**                                                                         | **Description**                                                                                                                                                |
| ----------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Hover](/code-navigation/features#hover)                               | Quickly view a symbol's type signature and documentation without switching to another source file                                                              |
| [Go to definition](/code-navigation/features#go-to-definition)         | Click the button or symbol name, navigates you to the symbol's definition                                                                                      |
| [Find references](/code-navigation/features#find-references)           | Selecting it in the hover lists all references, definitions, and implementations at the bottom, including precise and search-based results                     |
| [Find implementations](/code-navigation/features#find-implementations) | Click 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 action](/code-navigation/features#perform-an-action)                    | When browsing code, you can perform a couple of actions like open in code host, raw download and view blame.                                                   |

<Callout type="note">
	Read and learn more about [Code Navigation features here
	→](/code-navigation/features)
</Callout>

## Code Navigation types

There are two types of Code Navigation that Sourcegraph supports:

-   [Search-based Code Navigation](/code-navigation/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](/code-navigation/precise-code-navigation): Uses compile-time information to provide users with accurate cross-repository navigation experience across the entire code base.


## Architecture

Learn about how Code Navigation fits into Sourcegraph in the [architecture overview](/admin/architecture#code-navigation).
