GitHub has unveiled a technology preview of improved code searching capabilities on its popular code-sharing site, along with “precise” code navigation for Python.
Among the enhancements is a new code search engine built in Rust, oriented toward searching code and speed. In the technology preview, the search index covers more than five million of the most popular public repositories. Searches also can be made on private repositories if a user has access.
Features of the technology preview include 'smart' rankings and an index optimised for code and search for an exact string, with support for substring matches and special characters, this is in addition to scope searches with org:code or repo:code qualifiers, with auto-completion suggestions in the search box, plus refining of results using filters such as language:code and path:code and the ability to get bearings quickly with additional features, like a directory tree.
Search syntax can be found on GitHub.
Developers interested can sign up for the waitlist and provide feedback. Once the technology preview is enabled, developers can try it out on GitHub. At the outset, a separate interface will be provided for the new search as it is built out. Once GitHub is satisfied with the feedback and the technology is ready for wider adoption, GitHub will integrate it into the main GitHub.com experience.
Precise code navigation for Python is powered by a new stack graphs framework. Stack graphs enable encoding of detailed information about Python name binding rules. This enables determinations about which specific definition each reference refers to, with no additional configuration required for repos.
Until now code navigation on GitHub has been “fuzzy” or search-based; clicking on a reference would show all definitions in a repo with that name. This could result in a lot of noise when viewing definitions and references with a common name. For now, code navigation for other supported languages will continue to be fuzzy. Stack graph support for other languages will be added in coming months.
GitHub has made the new code navigation features available in the “files changed” tab of each pull request. Previously, they were available only when viewing files in GitHub’s code browser. Clicking on a reference or definition will take a developer to the code browser for the pull request’s head branch, giving developers more insight into the impact of changes.
GitHub’s latest changes follow code review controls introduced last month. Limits were put in place to deal with “drive-by” pull requests and spammy change requests.