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
I was wondering what way is suggested to build a stack graph of nested directories with files in those directories. Would it involve a recursive call on directories and then calling StackGraph::add_from_graph(someMasterGraph, fileStackGraph);? Is there any example tsg_source anyone would be willing to provide to create nodes for each directory and nodes for each file, then connect the files to the directory/would that even work? I'm essentially looking to create something like this:
with each f*.py having their own stack graph (that of course connect files/methods/functions with the right definitions, possibly from directories up or across).
Any suggestions/directions I should head?
I really think what y'all have built is so neat, just trying to learn how to use it! Super cool stuff.
The text was updated successfully, but these errors were encountered:
Hi @maxwnewcomer! Good question. What you are trying to achieve is certainly possible. You'll need to orchestrate a little using the API to make it happen. The general structure would be something like this:
For each directory in the tree (from top to bottom), create the nodes for that directory, and build the directory structure by creating edges between those nodes. This wouldn't be done using TSG, because that requires a syntax tree, which directories don't have. So you'll have to do that programmatically using the API. Create a file handle for each directory with StackGraph::add_file and create nodes with the other methods in StackGraph for each directory.
Build the stack graphs for the f*.py files using the TSG file using StackGraphLanguage.html::build_stack_graph_into. To make the connection with the containing directory, add global variables with the nodes files should connect to. In the TSG, declare that global variable, e.g. global DIR_NODE, and then add edges as you would with the ROOT_NODE.
Yes this makes so much sense, thank you so much for the clarification! Going to close, but will reopen if I have any further questions. Again, thanks so much.
I was wondering what way is suggested to build a stack graph of nested directories with files in those directories. Would it involve a recursive call on directories and then calling
StackGraph::add_from_graph(someMasterGraph, fileStackGraph);
? Is there any exampletsg_source
anyone would be willing to provide to create nodes for each directory and nodes for each file, then connect the files to the directory/would that even work? I'm essentially looking to create something like this:with each f*.py having their own stack graph (that of course connect files/methods/functions with the right definitions, possibly from directories up or across).
Any suggestions/directions I should head?
I really think what y'all have built is so neat, just trying to learn how to use it! Super cool stuff.
The text was updated successfully, but these errors were encountered: