mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-24 02:46:43 +00:00
Even more generic header printing in prettier_server
This commit is contained in:
parent
39ad3a625c
commit
e8409a0108
1 changed files with 2 additions and 2 deletions
|
@ -44,6 +44,7 @@ async function handleBuffer(prettier) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const headerSeparator = "\r\n";
|
const headerSeparator = "\r\n";
|
||||||
|
const contentLengthHeaderName = 'Content-Length';
|
||||||
|
|
||||||
async function* readStdin() {
|
async function* readStdin() {
|
||||||
let buffer = Buffer.alloc(0);
|
let buffer = Buffer.alloc(0);
|
||||||
|
@ -64,7 +65,6 @@ async function* readStdin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let contentLengthHeaderName = 'Content-Length';
|
|
||||||
let headersLength = null;
|
let headersLength = null;
|
||||||
let messageLength = null;
|
let messageLength = null;
|
||||||
main_loop: while (true) {
|
main_loop: while (true) {
|
||||||
|
@ -165,7 +165,7 @@ function sendResponse(response) {
|
||||||
jsonrpc: "2.0",
|
jsonrpc: "2.0",
|
||||||
...response
|
...response
|
||||||
});
|
});
|
||||||
let headers = `Content-Length: ${Buffer.byteLength(responsePayloadString)}${headerSeparator}${headerSeparator}`;
|
let headers = `${contentLengthHeaderName}: ${Buffer.byteLength(responsePayloadString)}${headerSeparator}${headerSeparator}`;
|
||||||
let dataToSend = headers + responsePayloadString;
|
let dataToSend = headers + responsePayloadString;
|
||||||
process.stdout.write(dataToSend);
|
process.stdout.write(dataToSend);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue