Search-based code navigation goes community-driven

GitHub has announced search-based code navigation for the Elixir programming language—and it marks a shift in how new languages get supported. Elixir support is the first example of a language community writing and submitting its own tagging implementation for GitHub's search-based code navigation system.

Since code navigation launched, GitHub has heard a recurring question from users: “When will my favorite language be supported?” With thousands of languages hosted on the platform, GitHub acknowledges it can only maintain support for a small subset itself. The company's answer has been to open up the integration path so language communities can contribute support directly—on the theory that the people who build a language understand it best.

How community tagging works

Contributing search-based code navigation for a language requires a Tree-sitter grammar. If one exists for your language, you can write tag queries using Tree-sitter's tree query language. These queries describe how code navigation systems scan syntax trees and extract declarations and references—a process called tagging.

Tagging is integrated into the tree-sitter command-line tool, so contributors can run and test queries locally before submission. When users push commits or open pull requests, GitHub's code navigation systems rely on these tag queries to populate jump-to-definition and find-all-references. A technical report detailing the architecture of GitHub's search-based code navigation implementation is available for those interested in the underlying design.

Getting started and submitting support

Documentation on writing tag queries—including how to write unit tests—is available on the Tree-sitter site. For practical examples, contributors can reference the Elixir tags implementation, or the queries written for Python and Ruby.

Once tag queries are implemented, tested, and producing satisfactory output from tree-sitter tags, the next step is submitting a request on the Code Search and Navigation Feedback discussion page. The Code Navigation team evaluates submissions for tag quality and backend load implications. If confident in the results, they enable the queries in testing for a subset of contributors before rolling out to all GitHub users across public and private repositories.

Scope and distinctions

Search-based code navigation should not be confused with GitHub code search. Code search spans the entire corpus of code on GitHub, while search-based code navigation operates within the reading experience of a single repository. The search-based system is also distinct from precise code navigation. GitHub says it hopes to eventually empower language communities to contribute to these and other related features as well.

GitHub states its commitment to working with language maintainers and contributors to keep the tagging rules useful and current. Both experienced language contributors and newcomers are encouraged to explore adding search-based code navigation support and to participate in the GitHub Discussions community.