Like grep, but uses tree-sitter grammars to search in structures instead of strings
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Brian Hicks cdf01e3f5c downgrade to avoid a broken version 1 day ago
nix update sources 2 months ago
scripts add a script to udpate submodules 1 month ago
src/bin add rust 1 month ago
vendor downgrade to avoid a broken version 1 day ago
.envrc add wrapper scripts to make running exploration commands easier 3 months ago
.gitignore cargo init 6 months ago
.gitmodules add rust 1 month ago
Cargo.lock update cargo deps 2 days ago
Cargo.toml update package versions 1 month ago add more TODOs 3 months ago turn off warning logspam when building vendored tree-sitter parsers 1 month ago
default.nix add libiconv dependency 1 month ago
shell.nix add libiconv dependency 1 month ago


Works like grep, but uses tree-sitter to search for structure instead of strings.


This isn't available packaged anywhere. That's fine, use nix:

nix-env -if


Use it like grep (or really, more like ack/ag/pt/rg.)

$ tree-grepper '(import_clause (import) (upper_case_qid)@name)'

tree-grepper uses Tree-sitter's s-expressions to find matches.

The binary name might change in the future if we find a better/shorter name. Stay tuned.

Some Terrible Benchmarks

On the first possible working version of tree-grepper:

Command Mean Time (Hyperfine)
tree-grepper '(import_clause)@import' 17.2ms
rg -t elm '^import' 10.3ms
grep -rE '^import' 71.0ms

So this is on rg's level of quickness (which makes sense, as this tool uses their tree walking/gitignoring library.) This tool may get slower as we add features, or faster as I learn more about how to write good Rust.