chanhx / crabviz

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

Issues with Anonymous Functions, Const Declarations, and Class Inheritance in TS/JS #30

Open mxyhi opened 6 months ago

mxyhi commented 6 months ago

In TypeScript/JavaScript, anonymous functions don't work, and the same goes for functions declared with 'const'. Also, class extension ('extends') inheriting methods from a base class doesn't work.

image image

👇But the following code snippet below fails to be recognized correctly.

image
chanhx commented 6 months ago

Currently, Crabviz analyzes calling relationships of three kinds of symbols: function, method, and constructor. And anonymous functions in JS/TS are marked as variables (You can check symbol kinds in the outline panel), which are filtered out, so you don't see them in the call graph.

Analyzing calling relationships of variables makes no sense in most cases, but I think we can do it in some cases for some languages, will try it later.

class extension ('extends') inheriting methods from a base class doesn't work.

I don't quite get it, could you provide some examples or explanations?