web icon indicating copy to clipboard operation
web copied to clipboard

Add tree-like visualization

Open EgorBu opened this issue 7 years ago • 6 comments

Hi, I used dashboard a bit and found that it's still hard to understand. When you use UAST from bblfsh as text - it's really verbose (even if you hide some attributes of nodes).

  • it's hard to read structure of code It will be really great to have tree visualization, so the structure will be easily readable + show attributes of a node by click (or just pointing by mouse, or show token always - everything else optionally, or etc.). Ex1: https://resources.jointjs.com/demos/javascript-ast Ex2: http://vpyast.appspot.com/

EgorBu avatar Aug 27 '17 23:08 EgorBu

We can use https://gojs.net/latest/samples/familyTree.html

mcuadros avatar Sep 19 '17 22:09 mcuadros

I did some investigation. Looks like the best choice for visualization library using with react is simple d3. I tried to render java example:

Hover on node: screen shot 2017-12-12 at 1 24 25 pm

Expand all nodes: screen shot 2017-12-12 at 1 44 18 pm

smacker avatar Dec 12 '17 08:12 smacker

I think that the internalType of the nose should be a label, like in the example I pasted, unless is a mess. The idea is visualize the hierarchy, and maybe have color codes for the roles

mcuadros avatar Dec 14 '17 09:12 mcuadros

I removed internalType because it looked like a mess. I see 4+ children quite often in examples and internalType is long often too, like "SingleVariableDeclaration". But of course it's not final solution. We will experiment with different visualization more. It was more like a technical investigation, how to integrate library in react without breaking vdom and reuse tree state.

smacker avatar Dec 14 '17 09:12 smacker

Has some AST visualization example https://code2vec.com/

bzz avatar Jun 11 '18 19:06 bzz

@ricardobaeta

marnovo avatar Jun 12 '18 12:06 marnovo