Fix
This commit is contained in:
1 parent
5daa8eba6c
commit
07ac240dfb
1 file changed
+5
-18
@@ -94,16 +94,17 @@ async function handleMetaMessage() {
|
||||
async function handleFormatMessage(message) {
|
||||
const plugins = [{ parsers }, docExplorerPlugin];
|
||||
const options = { ...message.options, plugins };
|
||||
|
||||
delete options.ast;
|
||||
delete options.doc;
|
||||
delete options.output2;
|
||||
|
||||
const formatResult = await formatCode(
|
||||
message.code,
|
||||
options,
|
||||
message.debug.rethrowEmbedErrors
|
||||
);
|
||||
|
||||
delete options.ast;
|
||||
delete options.doc;
|
||||
delete options.output2;
|
||||
|
||||
const response = {
|
||||
formatted: formatResult.formatted,
|
||||
cursorOffset: formatResult.cursorOffset,
|
||||
@@ -138,20 +139,6 @@ async function handleFormatMessage(message) {
|
||||
response.debug.ast = ast;
|
||||
}
|
||||
|
||||
if (!errored) {
|
||||
try {
|
||||
response.debug.doc = await prettier.__debug.formatDoc(
|
||||
await prettier.__debug.printToDoc(message.code, options),
|
||||
{ plugins }
|
||||
);
|
||||
ast = formatCode(ast, { parser: "json", plugins }).formatted;
|
||||
} catch {
|
||||
ast = serializeAst(ast);
|
||||
}
|
||||
|
||||
response.debug.ast = ast;
|
||||
}
|
||||
|
||||
if (message.debug.doc) {
|
||||
try {
|
||||
response.debug.doc = prettier.__debug.formatDoc(
|
||||
|
||||
Reference in new issue
Block a user