Support formatting multiple-language documents #568
Labels
epic: usability-end-users
Relates to the usability of Topiary for endusers to use Topiary as a generic "good enough" formatter
P2
major: an upcoming release
type: feature request
Is your feature request related to a problem? Please describe.
A lot of languages include other languages in their grammars, which tree-sitter supports somewhat (one can create a leaf that contains the code in the other language) and which some people use to provide fancy syntax highlighting for instance. I would want Topiary to support formatting such languages.
Some examples or use cases:
A personal project of mine would be to write a formatter for LilyPond, but LilyPond files regularly include some Guile code and I would want to support that too.
The OCaml ecosystem contains some other languages, namely OCamlLex, OCamlYacc and Menhir. Those languages are not super complicated but they involve chunks of OCaml that need formatting as well.
Other examples that don't concern me right now but might still matter to others: Markdown, Typst (probably?), languages that use fancy comments (see eg. the link above), web files that can include PHP, HTML, CSS, JS, SQL all in one file.
Additional context
There is currently no formatter for OCamlLex, OCamlYacc and Menhir.
ocp-indent
has simple support for them. OCamlFormat does not. I think it would be a very good way to distinguish ourselves from OCamlFormat and show the power of tree-sitter and Topiary. I think this would convince quite a few people.The text was updated successfully, but these errors were encountered: