Skip to content

Commit

Permalink
[wit-component] Extend the WIT printer for use in syntax highlighting (
Browse files Browse the repository at this point in the history
…#1956)

* [wit-component] add `push_keyword`, `push_doc`

* [wit-component] merge printing semicolon and newline

* [wit-component] add `newline`, `indent_start`, `indent_end`

* [wit-component] simplify `push_str` not accepting `\n`

* [wit-component] remove `push_` prefix from `Output` fns

* [wit-component] extract the indentation logic

* [wit-component] indent only when needed

* [wit-component] turn `Output` into a trait

* [wit-component] add `type`,`param`,`case` to `Output`

* [wit-component] add `version` to `Output`

* [wit-component] extract `print_package_outer`, `print_interface_outer`

* [wit-component] add `TypeKind` for syntax highlighting

* [wit-component] Introduce `WitPrinterExt`

Extract the parametrized `Output` from `WitPrinter` in order to
remove `Default` from the `Output` trait.
`WitPrinter` is kept for backwards compatibility.

* Revert "[wit-component] Introduce `WitPrinterExt`"

This reverts commit c23ad57.

* [wit-component] drop `Default` from `Output`, take `self` in `print` and `print_all`

* [wit-component]` rename `Output::type` to `ty`

* [wit-component] extract most of `OutputToString` fns to the `Output` trait

All methods that do not have to directly manipulate the state have now
a default implementation.

* [wit-component] make `WitPrinter::print` return `Result<()>`

As per PR request, merge `print` with `print_all`.
  • Loading branch information
tomasol authored Dec 19, 2024
1 parent 3c41360 commit 1e85a2a
Show file tree
Hide file tree
Showing 7 changed files with 561 additions and 282 deletions.
Loading

0 comments on commit 1e85a2a

Please sign in to comment.