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

Feature request: export call graphs as SVG after analyze finish by setting #42

Open
River2000i opened this issue Sep 4, 2024 · 5 comments

Comments

@River2000i
Copy link

Hi @chanhx, crabviz is a great tool to analyze codebase for us. We are using this tool to find out the potential impact modules of each PR.

However, we will analyze lots of rs files, which makes it impossible to open the generated svg file and export it manually. Therefore, we hope that the tool can automatically save the svg file when the analysis is finished.

@chanhx
Copy link
Owner

chanhx commented Sep 4, 2024

I'm glad it helped.

The auto-saving feature seems very specific to your use-case. I don't quite understand how you use the extension in your work flow, could you please give a further explanation? Maybe we can find an alternative approach.

@River2000i
Copy link
Author

Thanks for your response quickly!

I will select some directory in our Rust codebase as the input of crabviz. After SVG file generated, i will save it locally.
Then parse the SVG file as html.Node with golang and build a map relationship between id and file/function. Also the svg file will record the edge. I can get the call graph in the program.

IOW, parse the svg file to record it into our program's map, such as map[string]interface{} in go. Do some analyze for the whole call graph.

Once again, I would like to praise the project! If there are any idea, please ping me any time.

@chanhx
Copy link
Owner

chanhx commented Sep 6, 2024

Got it. Actually all the information you want is in the crabviz crate, but currently it can't be used outside the IDE environment. I will refactor the crate to make it more independently usable later.

For now, the easy way is to fork the extension, and modify it to fit your needs, and install it locally. I think you just need to call this function here, and modify the saveSVG method. Here is how to build the extension. Feel free to ask me if there are any problems.

@River2000i
Copy link
Author

Great idea. Thanks for your help!

I will do fork and develop locally from your suggestion.

@River2000i
Copy link
Author

Thanks for your help again. Your suggestion is work for me~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants