Skip to content

Commit 96eae6d

Browse files
committed
Use JSON-RPC id field if present
1 parent 1229225 commit 96eae6d

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/vs/workbench/api/browser/positron/mainThreadLanguageRuntime.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,14 @@ class ExtHostRuntimeClientInstance<Input, Output>
11691169
*/
11701170
performRpcWithBuffers<T>(request: Input, timeout: number | undefined, responseKeys: Array<string> = []): Promise<IRuntimeClientOutput<T>> {
11711171
// Generate a unique ID for this message.
1172-
const messageId = generateUuid();
1172+
let messageId;
1173+
if ((request as any)?.id) {
1174+
// If the request already has an id field, use it as id. This is typically
1175+
// the case with nested JSON-RPC messages.
1176+
messageId = (request as any).id;
1177+
} else {
1178+
messageId = generateUuid();
1179+
}
11731180

11741181
// Add the promise to the list of pending RPCs.
11751182
const pending = new PendingRpc<T>(responseKeys);

0 commit comments

Comments
 (0)