Skip to content

Commit eac1b74

Browse files
Hendrik van Antwerpenfelicitymayheiskrmyarb
authored
Unship precise code navigation (#52258)
Co-authored-by: Felicity Chapman <felicitymay@github.com> Co-authored-by: Kevin Heis <heiskr@users.noreply.github.com> Co-authored-by: Melanie Yarbrough <11952755+myarb@users.noreply.github.com>
1 parent a8a4fcf commit eac1b74

File tree

3 files changed

+8
-60
lines changed

3 files changed

+8
-60
lines changed

content/repositories/working-with-files/using-files/navigating-code-on-github.md

Lines changed: 7 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -19,45 +19,13 @@ Code navigation helps you to read, navigate, and understand code by showing and
1919

2020
![Screenshot showing a code file with a function called "request" highlighted and a pop-up window with information about the function underneath. The pop-up has two tabs: "Definition" and "Reference".](/assets/images/help/repository/code-navigation-popover.png)
2121

22-
Code navigation uses the open source [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) library. The following languages and navigation strategies are supported.
23-
24-
{% rowheaders %}
25-
26-
| Language | Search-based code navigation | Precise code navigation |
27-
|------------------|:--------------------------------------------:|:--------------------------------------------:|
28-
| Bash | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
29-
| C | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
30-
| C# | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
31-
| C++ | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
32-
| CodeQL | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
33-
| Elixir | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
34-
| Go | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
35-
| JSX | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
36-
| Java | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
37-
| JavaScript | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
38-
| Lua | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
39-
| PHP | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
40-
| Protocol Buffers | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
41-
| Python | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} |
42-
| R | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
43-
| Ruby | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
44-
| Rust | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
45-
| Scala | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
46-
| Starlark | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
47-
| Swift | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Not supported" %} |
48-
| TypeScript | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} |
49-
50-
{% endrowheaders %}
51-
52-
You do not need to configure anything in your repository to enable code navigation. We will automatically extract search-based and precise code navigation information for these supported languages in all repositories and you can switch between the two supported code navigation approaches if your programming language is supported by both.
53-
54-
{% data variables.product.prodname_dotcom %} has developed two code navigation approaches based on the open source [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) and [`stack-graphs`](https://github.com/github/stack-graphs) library:
55-
* Search-based - searches all definitions and references across a repository to find entities with a given name
56-
* Precise - resolves definitions and references based on the set of classes, functions, and imported definitions at a given point in your code
57-
58-
To learn more about these approaches, see "[Precise and search-based navigation](#precise-and-search-based-navigation)."
59-
60-
Future releases will add _precise code navigation_ for more languages, which is a code navigation approach that can give more accurate results.
22+
Code navigation uses the open source [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) library. The following languages support code navigation.
23+
24+
{% data reusables.search.code-nav-supported-languages %}
25+
26+
You do not need to configure anything in your repository to enable code navigation. We will automatically extract code navigation information for these supported languages in all repositories.
27+
28+
{% data variables.product.prodname_dotcom %} has developed a code navigation approach based on the open source [`tree-sitter`](https://github.com/tree-sitter/tree-sitter) library that searches all definitions and references across a repository to find entities with a given name.
6129

6230
{% ifversion code-view-ui %}You can use keyboard shortcuts to navigate within a code file. For more information, see "[AUTOTITLE](/get-started/accessibility/keyboard-shortcuts#navigating-within-code-files)."{% endif %}
6331

@@ -95,22 +63,6 @@ You can find all references for a function or method within the same repository
9563

9664
![Screenshot of the function window. A section, titled "3 References," is outlined in dark orange.](/assets/images/help/repository/find-all-references-tab.png)
9765

98-
## Precise and search-based navigation
99-
100-
Certain languages supported by {% data variables.product.prodname_dotcom %} have access to _precise code navigation_, which uses an algorithm (based on the open source [`stack-graphs`](https://github.com/github/stack-graphs) library) that resolves definitions and references based on the set of classes, functions, and imported definitions that are visible at any given point in your code. Other languages use _search-based code navigation_, which searches all definitions and references across a repository to find entities with a given name. Both strategies are effective at finding results and both make sure to avoid inappropriate results such as comments, but precise code navigation can give more accurate results, especially when a repository contains multiple methods or functions with the same name.
101-
102-
If you don't see the results you expect from a precise code navigation query, you can click on the "search-based" link in the displayed popover to perform search-based navigation.
103-
104-
![Screenshot of the function window. Two links, labeled, "Search for this symbol in this repository" and "all repositories," are outlined in dark orange.](/assets/images/help/repository/search-based-code-navigation-link.png)
105-
106-
If your precise results appear inaccurate, you can file a support request.
107-
108-
## Cross-repository precise code navigation
109-
110-
Cross-repo code navigation is available for languages that are supported by precise code navigation and the dependency graph. For more information, see "[AUTOTITLE](/code-security/supply-chain-security/understanding-your-software-supply-chain/about-the-dependency-graph)." With cross-repo code navigation, you can jump to the definition of functions or variables defined in dependencies imported by your project if that dependency is a repository hosted by {% data variables.product.prodname_dotcom %}. Cross-repo code navigation does not support find-all-references requests at this time.
111-
112-
![Screenshot of a code file on {% data variables.product.prodname_dotcom %}. On the line "import o.s.", the module name "o.s." is highlighted, and a "Definitions" modal shows a result tagged with "cross-repo result".](/assets/images/help/repository/cross-repository-code-navigation.png)
113-
11466
## Troubleshooting code navigation
11567

11668
If code navigation is enabled for you but you don't see links to the definitions of functions and methods:

content/search-github/github-code-search/about-github-code-search.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ Code search is integrated with features in the search interface on {% data varia
2222

2323
{% data variables.product.prodname_dotcom %} code search provides code navigation for supported languages. This includes jumping to the definition of and finding references for programming language constructs like classes, structs, functions, and methods. See "[AUTOTITLE](/repositories/working-with-files/using-files/navigating-code-on-github)."
2424

25-
Supported languages for code navigation include:
26-
27-
{% data reusables.search.code-nav-supported-languages %}
28-
2925
## Limitations
3026

3127
We have indexed many public repositories for code search, and continue to index more. Additionally, the private repositories of {% data variables.product.prodname_dotcom %} users are indexed and searchable by those that already have access to those private repositories on {% data variables.product.prodname_dotcom %}. However, very large repositories may not be indexed at this time, and not all code is indexed.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
| Python {% ifversion fpt or ghec %}| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} <br>precise| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Unsupported" %} |{% elsif ghes %}| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Unsupported" %} |{% endif %}
1+
| Python {% ifversion fpt or ghec %}| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Unsupported" %} |{% elsif ghes %}| {% octicon "check" aria-label="Supported" %} | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %}<br>pip | {% octicon "check" aria-label="Supported" %} | {% octicon "x" aria-label="Unsupported" %} |{% endif %}

0 commit comments

Comments
 (0)