Paul Krill
Editor at Large

GitHub previews enhanced code search

news
Dec 9, 20213 mins

The popular code-sharing site also introduced improved code navigation for Python, with support for additional languages to come.

programming / coding / development / developer / lines of code / remote desktop
Credit: Dean Mitchell / Getty Images

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 optimized for code.
  • Search for an exact string, with support for substring matches and special characters.
  • Scope searches with org:code or repo:code qualifiers, with auto-completion suggestions in the search box.
  • Refining of results using filters such as language:code and path:code.
  • 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.

Paul Krill

Paul Krill is editor at large at InfoWorld. Paul has been covering computer technology as a news and feature reporter for more than 35 years, including 30 years at InfoWorld. He has specialized in coverage of software development tools and technologies since the 1990s, and he continues to lead InfoWorld’s news coverage of software development platforms including Java and .NET and programming languages including JavaScript, TypeScript, PHP, Python, Ruby, Rust, and Go. Long trusted as a reporter who prioritizes accuracy, integrity, and the best interests of readers, Paul is sought out by technology companies and industry organizations who want to reach InfoWorld’s audience of software developers and other information technology professionals. Paul has won a “Best Technology News Coverage” award from IDG.

More from this author