GitHub has announced to improve its code navigation feature with two enhancements shortly after it made significant changes to its code search option. The improvements are available on github.com and can also be found in the new code search technology preview.
Until now, code navigation features were only available when viewing files in GitHub’s code browser. As of today, code navigation is also available in the “files changed” tab of each pull request: Clicking on a definition or reference will take you to the code browser for the pull request’s head branch. This gives you more insight into the impact of your changes, for instance, by letting you see all of the callers that would be affected by a change to a function.
Now, Github has made it more precise for Python. Code navigation results for python are powered by new stack graphs framework. Stack graphs encode detailed information about Python’s name binding rules, allowing to determine which specific definition each reference refers to.
“Stack graphs require no additional configuration in your repositories. You do not need to configure any CI workflows or tell us how your Python project is built. It works for all public repositories and for any private repositories that you have access to…” says Douglas Creager, Github.
For now, code navigation for other supported languages will continue to provide search-based results. Over the coming months, Github has planned to add stack graph support for additional languages. The stack-graphs library is open source and builds on the Tree-sitter ecosystem of parsers. “We will also be publishing information on how language communities can self-serve stack graph support for their languages, should they wish to.”