Fix deprecation warnings

This commit is contained in:
Quinten Kock 2025-12-02 21:25:45 +01:00
parent e898bd91f4
commit b738e9aab4
2 changed files with 29 additions and 4 deletions

25
package-lock.json generated
View File

@ -5855,6 +5855,31 @@
"dev": true,
"license": "MIT"
},
"node_modules/encoding": {
"version": "0.1.13",
"resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.13.tgz",
"integrity": "sha512-ETBauow1T35Y/WZMkio9jiM0Z5xjHHmJ4XmjZOq1l/dXz3lr2sRn87nJy20RupqSh1F2m3HHPSp8ShIPQJrJ3A==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"iconv-lite": "^0.6.2"
}
},
"node_modules/encoding/node_modules/iconv-lite": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz",
"integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3.0.0"
},
"engines": {
"node": ">=0.10.0"
}
},
"node_modules/end-of-stream": {
"version": "1.4.5",
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz",

View File

@ -76,17 +76,17 @@ function ensureLspForKey(
while (true) {
const headerEnd = entry.buffer.indexOf("\r\n\r\n");
if (headerEnd === -1) break;
const header = entry.buffer.slice(0, headerEnd).toString();
const header = entry.buffer.subarray(0, headerEnd).toString();
const m = header.match(/Content-Length:\s*(\d+)/i);
if (!m) {
// Malformed, drop
entry.buffer = entry.buffer.slice(headerEnd + 4);
entry.buffer = entry.buffer.subarray(headerEnd + 4);
continue;
}
const len = parseInt(m[1], 10);
const totalLen = headerEnd + 4 + len;
if (entry.buffer.length < totalLen) break; // wait for more
const body = entry.buffer.slice(headerEnd + 4, totalLen).toString();
const body = entry.buffer.subarray(headerEnd + 4, totalLen).toString();
// Forward body to all attached ports
try {
entry.ports.forEach((p) => {
@ -103,7 +103,7 @@ function ensureLspForKey(
} catch (err) {
console.warn("Failed to forward LSP message to renderer", err);
}
entry.buffer = entry.buffer.slice(totalLen);
entry.buffer = entry.buffer.subarray(totalLen);
}
});