Multiple crumbs view is skewed
xlab opened this issue · 5 comments
Hello, I'm playing with CC comments in my Go backend with lots of microservices, currently I'm trying to document a single flow of user authorization, that is split between different files. I'm using numbered code crumbs, but the view is getting skewed and not readable in the end, e.g.
I have multiple numbered CC's in the same file, so the view orders them not by the tailing order, but in the order of location in files. It think this is an issue, any suggestions how to avoid this?
main.go
: 1 as entrypointhandler.go
: 2, 3, then 7service.go
: 4, 5 and 6
The flow is expected as this:
main.go
(1) -> handler.go
(2,3) -> service.go
(4,5,6) -> handler.go
(7)
I have an idea how to resolve this. Consider there are two trees, one is the file tree, and another one is the tails view tree. Currently it is sorted by file names in the left tree, and the right tree is flat and unsorted, with a lot of pointy arrows.
A solution to this problem is to make the second tree not flat, but with indentation and collapsible:
.
└── main.go
├── [#1] Authorization Endpoint
└── handler.go
├── [#2] Authorization Handler
├── [#3] Check Credentials
├── service.go
│ ├── [#4] Account Authorization Method
│ ├── [#5] Account Read from DB
│ └── [#6] Password Check
└── [#7] New JWT Token
That way is is also sorted by the tail numbers. Of course it is not always possible to sort by tail numbers, especially when browsing multiple cross-referenced codebases, but an option to specify the sort preference is a must in this situation.
Awesome stuff) will implement that ASAP. Or you want to contribute? Help is very much needed and appreciated)
@Bogdan-Lyashenko I tried to study your code of graph renderer, I'm too weak JS developer to extend that, unfortunately. :)
I decided to code a small tool that exports all codecrumbs into a single markdown file, will wait for progress on your side, so I could use that cool visualisation too.
@xlab fixed that (codecrumbs v1.2.0). Now, files tree will be sorted in the order of codecrumbs trail steps, so you always reading from the top to the bottom without messed up intersections