From 29a32039bab78bda4caf52fe90ba232203425462 Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Mon, 30 Oct 2023 22:16:00 +0200 Subject: [PATCH] Start message numbering during prettier init, log error message text --- crates/prettier/src/prettier_server.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/prettier/src/prettier_server.js b/crates/prettier/src/prettier_server.js index a56c220f208607d00d1ef413c8529dd4244008b4..9967aec50f4b9497af33d8811167b48a7a17f0f1 100644 --- a/crates/prettier/src/prettier_server.js +++ b/crates/prettier/src/prettier_server.js @@ -55,8 +55,11 @@ async function handleBuffer(prettier) { } // allow concurrent request handling by not `await`ing the message handling promise (async function) handleMessage(message, prettier).catch(e => { - sendResponse({ id: message.id, ...makeError(`error during message handling: ${e}`) }); - }); + const errorMessage = message; + if ((errorMessage.params || {}).text !== undefined) { + errorMessage.params.text = "..snip.."; + } + sendResponse({ id: message.id, ...makeError(`error during message '${JSON.stringify(errorMessage)}' handling: ${e}`) }); }); } } @@ -172,7 +175,7 @@ async function handleMessage(message, prettier) { sendResponse({ id, result: null }); } else if (method === 'initialize') { sendResponse({ - id, + id: id || 0, result: { "capabilities": {} }