Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] master from vuejs:master #76

Merged
merged 2 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion packages/typescript-plugin/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,22 @@ function sendRequestWorker<T>(request: Request, client: net.Socket) {
dataChunks.push(chunk);
});
client.on('end', () => {
if (!dataChunks.length) {
console.warn('[Vue Named Pipe Client] No response from server for request:', request.type);
resolve(undefined);
return;
}
const data = Buffer.concat(dataChunks);
const text = data.toString();
resolve(JSON.parse(text));
let json = null;
try {
json = JSON.parse(text);
} catch (e) {
console.error('[Vue Named Pipe Client] Failed to parse response:', text);
resolve(undefined);
return;
}
resolve(json);
});
client.write(JSON.stringify(request));
});
Expand Down
1 change: 0 additions & 1 deletion packages/typescript-plugin/lib/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ export function startNamedPipeServer(serverKind: ts.server.ProjectKind, currentD
}
else {
console.warn('[Vue Named Pipe Server] Unknown request type:', request.type);
connection.write(JSON.stringify(null));
}
connection.end();
});
Expand Down
Loading