Search-based Code Navigation

Supported on Enterprise plans.

Available via VS Code and JetBrains editor extensions and the Web.

Learn and understand about Search-based Code Navigation.

Sourcegraph comes with a default built-in code navigation provided by search-based heuristics. It works out of the box with all of the most popular programming languages.

How does it work?

Search-based Code Navigation provides 3-core navigation features:

  • Jump to definition: Performs a symbol search.
  • Hover documentation: First, finds the definition. Then, extracts documentation from comments near the definition.
  • Find references: Performs a case-sensitive word-boundary cross-repository plain text search for the given symbol

Search-based Code Navigation also filters results by file extension and by imports at the top of the file for some languages.

What configuration settings can I apply?

The symbols container recognizes these environment variables:

Env VarsDeafultDetails
CTAGS_COMMANDuniversal-ctagsCtags command (should point to universal-ctags executable compiled with JSON and seccomp support)
CTAGS_PATTERN_LENGTH_LIMIT250The maximum length of the patterns output by ctags
LOG_CTAGS_ERRORSfalseLog ctags errors
SANITY_CHECKfalseCheck that go-sqlite3 works then exit 0 if it's ok or 1 if not
SYMBOLS_CACHE_DIR/tmp/symbols-cacheDirectory in which to store cached symbols
SYMBOLS_CACHE_SIZE_MB100000Maximum size of the disk cache (in megabytes)
CTAGS_PROCESSESstrconv.Itoa(runtime.GOMAXPROCS(0))Number of concurrent parser processes to run
REQUEST_BUFFER_SIZE8192Maximum size of buffered parser request channel
PROCESSING_TIMEOUT2 hrsMaximum time to spend processing a repository
MAX_TOTAL_PATHS_LENGTH100000Maximum sum of lengths of all paths in a single call to git archive
USE_ROCKSKIPfalseEnables Rockskip for fast symbol searches and search-based code navigation on repositories specified in ROCKSKIP_REPOS, or respositories over ROCKSKIP_MIN_REPO_SIZE_MB in size
ROCKSKIP_REPOSN/AIn combination with USE_ROCKSKIP=true this specifies a comma-separated list of repositories to index using Rockskip
ROCKSKIP_MIN_REPO_SIZE_MBN/AIn combination with USE_ROCKSKIP=true all repos that are at least this big will be indexed using Rockskip
MAX_CONCURRENTLY_INDEXING4Maximum number of repositories being indexed at a time by Rockskip (also limits ctags processes)

The default values for these environment variables come from config.go.

To enable precise code navigation for your repository, see our docs here.

More resources

Rockskip

Rockskip: Symbol sidebar and search navigation

Enhances symbol sidebar and search-based code navigation experience in large monorepos.

Previous
Features