Allow `originalText` to be passed to `formatAST()` (#4677)
This allows `prettier.__debug.formatAST` to not crash when given the AST for the below code (taken from https://astexplorer.net/), which is useful when trying to use Prettier as a code generator for an AST without corresponding source code (https://github.com/prettier/prettier/issues/4675) ```js let tips = [ "Click on any AST node with a '+' to expand it", "Hovering over a node highlights the \ corresponding part in the source code", "Shift click on an AST node expands the whole substree" ]; function printTips() { tips.forEach((tip, i) => console.log(`Tip ${i}:` + tip)); } ```master
parent
f0907a049d
commit
88be12ca07
|
@ -9,6 +9,7 @@ const resolveParser = require("./parser").resolveParser;
|
|||
const hiddenDefaults = {
|
||||
astFormat: "estree",
|
||||
printer: {},
|
||||
originalText: undefined,
|
||||
locStart: null,
|
||||
locEnd: null
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue