Support async parser (#12748)

This commit is contained in:
fisker Cheung authored and GitHub committed 2022-05-04 11:15:48 +08:00
1 parent 62a59c341c
commit e14411c278
17 files changed
+217 -50

No files matched your search

+4 -2
View File
@@ -91,7 +91,9 @@ async function handleMessage(message) {
let ast;
let errored = false;
try {
ast = serializeAst(prettier.__debug.parse(message.code, options).ast);
ast = serializeAst(
(await prettier.__debug.parse(message.code, options)).ast
);
} catch (e) {
errored = true;
ast = String(e);
@@ -110,7 +112,7 @@ async function handleMessage(message) {
if (message.debug.doc) {
try {
response.debug.doc = await prettier.__debug.formatDoc(
prettier.__debug.printToDoc(message.code, options),
await prettier.__debug.printToDoc(message.code, options),
{ parser: "babel", plugins }
);
} catch (e) {