Co-authored-by: Georgii Dolzhykov <thorn.mailbox@gmail.com>
1.1 KiB
Use arrays instead of concat (#9733 by @fisker, @thorn0)
To simplify the code of AST printers, the data structure for the concatenation command has been changed from { type: 'concat', parts: Doc[] } to Doc[]. The old format is deprecated, but for compatibility, the doc printer still supports it, and doc.builders.concat (as well as some other builder functions) will keep using it until the next major version of Prettier.
If you're a plugin author, this change should only concern you if your plugin introspects or modifies composed docs. If it happens to be the case, please make your plugin compatible with future versions of Prettier by tweaking the introspecting code to support the new format. There also is an off-chance where this change can break things, namely if a plugin calls another plugin to print an embedded language and then introspects the returned doc. There seems to be no reason for plugins to do that though.
// Prettier stable
myDoc = group(concat(["foo", line, "bar"]));
// Prettier master
myDoc = group(["foo", line, "bar"]);