Skip to content

Commit f6ccd2e

Browse files
Syntactic indexing public doc
1 parent 1435931 commit f6ccd2e

File tree

2 files changed

+43
-0
lines changed

2 files changed

+43
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Syntactic Code Navigation
2+
3+
<TierCallout>
4+
Supported on [Enterprise](/pricing/enterprise) plans.
5+
<user>
6+
This feature is currently experimental and enabled by default for Cloud customers
7+
</user>
8+
</TierCallout>
9+
10+
Syntactic code navigation is an opt-in zero configuration feature that improves code navigation for certain languages in the absence of
11+
[Precise code navigation](./precise_code_navigation) set up. It works by periodically indexing repositories for which it is [enabled](#enabling-syntactic-code-navigation), using high level syntax analysis heuristics.
12+
13+
This mechanism is more robust than search-based navigation, but less powerful than Precise code navigation.
14+
When syntactic indexing data is available for a given file and repository, it will be selected over search-based navigation automatically,
15+
but only if Precise data is not available. To summarise the order of priorities is as follows:
16+
17+
- Precise data
18+
- Syntactic, if no precise data available
19+
- Search-based, if no syntactic available
20+
21+
## Enabling Syntactic code navigation
22+
23+
First, enable the experimental feature flag in Site config:
24+
25+
```json
26+
"experimentalFeatures.codeintelSyntacticIndexing.enabled": true
27+
```
28+
29+
Next, you need to ensure that syntactic indexing is enabled in a code graph configuration policy. Note that for cloud customers this feature is enabled by default for all repositories, as part of
30+
automatically managed policy called `[Sourcegraph Managed] Head of default branch policy`.
31+
32+
For all other deployments, you will need to create a HEAD policy with "Syntactic indexing" enabled:
33+
34+
![Screenshot of sourcegraph interface demonstrating Syntactic indexing toggle enabled for a code graph policy](https://storage.googleapis.com/sourcegraph-assets/Docs/syntactic-indexing-policy.png)
35+
36+
Syntactic indexing can only be enabled if the policy type is set to HEAD – only indexing the tip of default branch on each repository. You may choose to apply this policy only to selected repositories, although the recommendation is to enable it instance-wide.
37+
38+
## Supported languages
39+
40+
Syntactic code navigation requires language-specific implementations, and we currently support the following languages: [Java](https://www.java.com/en/), [Go](https://go.dev/), [Scala](https://scala-lang.org).
41+
42+
We are constantly looking to expand the list of supported languages, with Python, Typescript/Javascript, C, C++, C# planned. If you are interested in syntactic indexing for these or any other languages, please contact your Sourcegraph account representative.

src/data/navigation.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ export const navigation: NavigationItem[] = [
105105
{ title: "Features", href: "/code-search/code-navigation/features", },
106106
{ title: "Search-based code navigation", href: "/code-search/code-navigation/search_based_code_navigation", },
107107
{ title: "Precise code navigation", href: "/code-search/code-navigation/precise_code_navigation", },
108+
{ title: "Syntactic code navigation", href: "/code-search/code-navigation/syntactic_code_navigation", },
108109
{ title: "Auto-indexing", href: "/code-search/code-navigation/auto_indexing", },
109110
{ title: "Environment Variables", href: "/code-search/code-navigation/envvars", },
110111
{ title: "Troubleshooting", href: "/code-search/code-navigation/troubleshooting", },

0 commit comments

Comments
 (0)