Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate using tree-sitter-stack-graphs for name resolution #10

Open
begleynk opened this issue Jan 17, 2024 · 1 comment
Open

Investigate using tree-sitter-stack-graphs for name resolution #10

begleynk opened this issue Jan 17, 2024 · 1 comment
Labels
enhancement New feature or request question Further information is requested

Comments

@begleynk
Copy link
Member

I posted Dossier on the Rust subreddit, and user grunzl very helpfully pointed out that we could consider using https://github.com/github/stack-graphs and its tree-sitter integration for name resolution instead of rolling our own.

In short, stack graphs create a graph of symbols and their scopes, which you can then probe to resolve names to their definitions (aka "jump to definition"). You have to write a similar DSL to tree sitter queries to describe the rules for each language, and you can then use stack graphs to resolve names even across imports.

This is the technology that apparently powers GitHub's code navigation.

Definitely worth exploring, since relying on existing research/tooling in this area would be much preferred to rolling our own.

@begleynk begleynk added enhancement New feature or request question Further information is requested labels Jan 17, 2024
@Boscop
Copy link

Boscop commented Sep 27, 2024

Have you looked into tree-sitter-stack-graphs since then?

There are already crates for the languages typescript, python, javascript, ruby, java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants