timdp / swirly

A marble diagram generator.
https://swirly.dev
MIT License
118 stars 3 forks source link

Display Indention #3

Closed niklas-wortmann closed 4 years ago

niklas-wortmann commented 4 years ago

Is there a way to demonstrate a later subscription, e.g with indention?

Following example:

--a--b-|

       --x---y--|

> concat

--a--b---x---y--|

right now the spaces in the beginnning for the second input observable causes the arrow to start on the very left side of the diagram. It would be cool if there is a way to show that it starts with the completion of the first observable?

timdp commented 4 years ago

I was hoping to find this in the marble diagram syntax since Swirly just passes the string including whitespace to TestScheduler.parseMarbles().

There's partial support in the sense that whitespace is treated as equivalent to -. However, parseMarbles() just returns an array of messages without any metadata about the encapsulating observable, which would be required to understand what the initial frame is.

I've therefore patched whitespace detection into Swirly's parser. It's still on a branch so please try https://swirly-git-marble-whitespace.timdp.now.sh/ with your code.

Sidenote: I also noticed that some tests use the ^ subscription marker in the stream definition. I initially thought that would help, but it's basically just ignored.

niklas-wortmann commented 4 years ago

That actually works for me just fine, ^ would also be a good option but the whitespace patching works great for me.

timdp commented 4 years ago

Fair enough. Available right now as of v0.13.7!