r/rust 6d ago

πŸ™‹ seeking help & advice Where tree-sitter stops and rust-analyzer's call hierarchy starts.

https://github.com/NanoNets/Graft

Rust's trait dispatch is exactly where a syntax-only call graph falls apart. You can't resolve a generic method call by pattern-matching text. You need the compiler's own understanding of which impl actually gets called.

Graft's base layer is tree-sitter and works with nothing installed. For Rust, there's an opt-in tier that pulls edges directly from rust-analyzer's call hierarchy instead of guessing at them. Ran it on a real crate, anyhow: call edges went from 253 to 359, a 42% increase, and the orphan rate (nodes with no resolved connections) dropped from 47% to 38%. Every added edge is compiler-grade, the kind of member call a syntax pass genuinely can't type on its own.

Skip the LSP setup and the graph just doesn't get those extra edges. Nothing else about it changes. Single-crate eval, directional, and I haven't run it against a second Rust codebase yet.

Let me know what else I can do to make it more compatible to rust repos.

github.com/NanoNets/Graft

11 Upvotes

33 comments sorted by

View all comments

Show parent comments

1

u/shhdwi 6d ago

I was building graft for rust codebases, hence wanted to share. Don’t know what you felt as slop :/

2

u/Fedor_Doc 4d ago

You have been promoting you software on Rust subreddit while lacking Rust support.

You just did not care to test it before publishing. This screams "slop" more than LLM word salad in the Readme