Add a tree-sitter query language plugin#66
Open
janrito wants to merge 1 commit into
Open
Conversation
Index .scm files — the tree-sitter query language rbtr's own plugins are written in. Each top-level pattern becomes a doc_section chunk, named by its own outer capture where the author gave one (query.scm pairs an optional @_section_name to a direct-child capture), else a legitimately anonymous section; nested captures stay full-text-searchable either way. No name_extractor — the query resolves the name. Adds the tree-sitter-query dependency and a comprehensive sample exercising every construct. rbtr now indexes its own query files. Update docs (rbtr-languages skill, README, ARCHITECTURE): add the query plugin to the primary-path list and note that rbtr now indexes .scm files (including third-party tags/highlights/injections).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add a plugin for the tree-sitter query language itself, so rbtr indexes
.scmfiles.
rbtr skipped
.scmfiles entirely — yet those are what its own plugins are nowwritten in (the previous PR), and what every grammar ships (
tags.scm,highlights.scm,injections.scm). With queries living in files, rbtr shouldnavigate them like any other source.
It's an ordinary query-path plugin, like css or json: each top-level pattern
becomes an indexed section. A pattern takes its
own outer capture where the author gave one (
(function_definition …) @function→ "function"), expressed in the query via an optional@_section_name; a pattern with no label of its own — a predicate-wrappedinjection rule, or one anchored at a wrapper like
(module … @variable)— is ananonymous section. An earlier
name_extractorwas backed out:that hook is for a name a query can't reach, not for inventing one.
tree-sitter-queryis a required core dependency.Indexing
python.scmyields sectionsfunction,class,variable,import; a highlights-style file yields labelled sections where a patterncarries a capture, anonymous ones where it doesn't.
A sample covering every construct pins the labelled-vs-anonymous naming
rule, and the
.scmfiles from the previous PR serve as real-corpus input.