opengoal-vscode/patches/vscode-jsonrpc+8.0.2.patch

24 lines
1.4 KiB
Diff

diff --git a/node_modules/vscode-jsonrpc/lib/common/messageReader.js b/node_modules/vscode-jsonrpc/lib/common/messageReader.js
index 678edfc..43041d5 100644
--- a/node_modules/vscode-jsonrpc/lib/common/messageReader.js
+++ b/node_modules/vscode-jsonrpc/lib/common/messageReader.js
@@ -134,11 +134,16 @@ class ReadableStreamMessageReader extends AbstractMessageReader {
}
const contentLength = headers.get('Content-Length');
if (!contentLength) {
- throw new Error('Header must provide a Content-Length property.');
+ const bodyBuffer = this.buffer.tryReadBody(this.buffer._totalLength);
+ const bodyString = bodyBuffer.toString();
+ console.log(`[LSP Debug] Headers - ${JSON.stringify(headers, (key, value) => (value instanceof Map ? [...value] : value))} Body - ${bodyString}`);
+ this.fireError(new Error('Bad LSP Response - Header must provide a Content-Length property. Check Console Logs'));
+ return;
}
const length = parseInt(contentLength);
if (isNaN(length)) {
- throw new Error('Content-Length value must be a number.');
+ this.fireError(new Error('Bad LSP Response - Content-Length value must be a number.'));
+ return;
}
this.nextMessageLength = length;
}