lukeed/tidyPublic

perf: flat doc stream

Docs are one stream of elements, emitted in order: a container records
where it ends, so a concatenation is elements next to each other and
needs no node or list. The printer keeps Prettier's command stack, with
each command a range of the stream, so fits and the rest commands mean
what they mean in Prettier. Breaks propagate as containers close.

The HTML printer emits in order; embedded code is formatted before
anything is emitted, so a hook that declines leaves nothing behind.
Output is the same on all 634 files of the corpora and fixtures.
Pages on one thread: 250 to 207 ms.
LELuke Edwards authored
c0f3dc1Patch
Parentc786fd1
6 files changed+1081-1007
StackedSplit
crates/tidyrs/examples/doc.rs+52 −37
crates/tidyrs/src/doc/mod.rs+180 −244
crates/tidyrs/src/doc/print.rs+318 −235
crates/tidyrs/src/html/embed.rs+249 −190
crates/tidyrs/src/html/mod.rs+2 −2
crates/tidyrs/src/html/print.rs+280 −299