You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I've recently been trying to use the tree-sitter-stack-graphs-python (the CLI ) to query definition of references in a project.
What I'm noticing is that for references that are not defined in the same "package", the query doesn't return the actual definition. Even if all files from reference to definition are indexed, the query stops at the import statement on the file with the reference. Please see context for the example. Questions below
Context
What works
Using the example in the blog post that uses stove.py, kitchen.py and chef.py to query for the broil reference I get the actual function definition in stove.py, as expected.
tree-sitter-stack-graphs-python query --database=indexes/test_project definition ./test_project/chef.py:3:1
.../test_project/chef.py:3:1: found 2 definitions for 2 references
found 2 references at position
0: queried reference
.../test_project/chef.py:3:1:
3 | boil()
| ^^^^
has no definitions
1: queried reference
.../test_project/chef.py:3:1:
3 | boil()
| ^^^^
has 2 definitions
.../test_project/chef.py:1:21:
1 | from kitchen import boil
| ^^^^
.../test_project/stove.py:5:5:
5 | def boil():
| ^^^^
What doesn't work
By modifying the project structure to have the stove.py and chef.py in different packages (still submodules of the project) the query then stops at the import statement in chef.py (so it finds only 1 definition, not the second one I'm more interested in).
I'd expect that querying the boil reference from staff/chef.py:3:1 would show the definition of boil in kitchen/stove.py, given that the path to the definition is all indexed on the graph database.
Why doesn't the query return kitchen/stove.py as a definition for boil?
Do I have to make multiple queries to get to the definition myself? That is, is what I'm seeing the expected behavior?
Also, am I forgetting something?
(I've just started to use this tool, so it is very likely that I am simply skipping some step)
(or that my expectation is not the expected behavior)
Thanks :)
The text was updated successfully, but these errors were encountered:
Hi, I've recently been trying to use the
tree-sitter-stack-graphs-python
(the CLI ) to query definition of references in a project.What I'm noticing is that for references that are not defined in the same "package", the query doesn't return the actual definition. Even if all files from reference to definition are indexed, the query stops at the import statement on the file with the reference. Please see context for the example. Questions below
Context
What works
Using the example in the blog post that uses
stove.py
,kitchen.py
andchef.py
to query for thebroil
reference I get the actual function definition instove.py
, as expected.What doesn't work
By modifying the project structure to have the
stove.py
andchef.py
in different packages (still submodules of the project) the query then stops at the import statement inchef.py
(so it finds only 1 definition, not the second one I'm more interested in).I'd expect that querying the
boil
reference fromstaff/chef.py:3:1
would show the definition ofboil
inkitchen/stove.py
, given that the path to the definition is all indexed on the graph database.Modified project structure
Query results
File contents
Files indexed
Questions
Why doesn't the query return
kitchen/stove.py
as a definition forboil
?Do I have to make multiple queries to get to the definition myself? That is, is what I'm seeing the expected behavior?
Also, am I forgetting something?
(I've just started to use this tool, so it is very likely that I am simply skipping some step)
(or that my expectation is not the expected behavior)
Thanks :)
The text was updated successfully, but these errors were encountered: