chanhx / crabviz

🦀 A LSP-based interative call graph generator
Apache License 2.0
674 stars 22 forks source link

Only function names without directed segments #5

Open forgetsuffering opened 1 year ago

forgetsuffering commented 1 year ago

I have tried this plug-in several times with different java projects, and the generated results are only the functions in the project, and there is no calling relationship between functions, that is, directed line segments.I'm desperate to know what's causing this. ![Uploading pic.PNG…]()

chanhx commented 1 year ago

What extensions for Java do you have? I have the "Extension Pack for Java" installed in my VS Code, and the calling relationships are shown on the call graph.

Crabviz utilizes the "call hierarchy" capability of LSP server to get the calling relationships, so maybe you should check if "call hierarchy" for Java is supported in your VS Code. Just right click on the name of a Java function, and see if there is a "Show Call Hierarchy" option in the context menu.

forgetsuffering commented 1 year ago

What extensions for Java do you have? I have the "Extension Pack for Java" installed in my VS Code, and the calling relationships are shown on the call graph.

Crabviz utilizes the "call hierarchy" capability of LSP server to get the calling relationships, so maybe you should check if "call hierarchy" for Java is supported in your VS Code. Just right click on the name of a Java function, and see if there is a "Show Call Hierarchy" option in the context menu.

Ok, thank you. By the way, do I need to compile the project before using this function.

chanhx commented 1 year ago

do I need to compile the project before using this function.

No, you don't need to compile it.

chanhx commented 1 year ago

I came across this issue recently. It seems to happen when you open a new project, and run Crabviz without any tabs open (the language server has not started). I just rerun the command after waiting a few seconds in that case, and then I got the result as expected. Maybe you can try it again if no edges are shown in the result.

The response of vscode.prepareCallHierarchy is an empty array in the above case, not much info to tell whether the language server is ready or not, so there is no retry logic currently. But I think maybe we can track whether all responses are empty, and retry several times before getting non-empty response. I will try it later.