From 4f41508d532690e0e158315d70f0d05341a3eb3a Mon Sep 17 00:00:00 2001 From: Ulugbek Abdullaev Date: Thu, 16 Nov 2023 18:44:06 +0100 Subject: [PATCH] extension host: use UUID for `delegatingCommandId` instead of `Date.now()` because when there are several extension hosts (created using "extensions.experimental.affinity") and they happen to be created at the same time, those IDs equal and command invocation may go to incorrect extension host --- src/vs/workbench/api/common/extHostCommands.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/vs/workbench/api/common/extHostCommands.ts b/src/vs/workbench/api/common/extHostCommands.ts index 7b883742cf026..586056f01a359 100644 --- a/src/vs/workbench/api/common/extHostCommands.ts +++ b/src/vs/workbench/api/common/extHostCommands.ts @@ -31,6 +31,7 @@ import { StopWatch } from 'vs/base/common/stopwatch'; import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { TelemetryTrustedValue } from 'vs/platform/telemetry/common/telemetryUtils'; import { IExtHostTelemetry } from 'vs/workbench/api/common/extHostTelemetry'; +import { generateUuid } from 'vs/base/common/uuid'; interface CommandHandler { callback: Function; @@ -342,7 +343,7 @@ export const IExtHostCommands = createDecorator('IExtHostComma export class CommandsConverter implements extHostTypeConverter.Command.ICommandsConverter { - readonly delegatingCommandId: string = `__vsc${Date.now().toString(36)} `; + readonly delegatingCommandId: string = `__vsc${generateUuid()}`; private readonly _cache = new Map(); private _cachIdPool = 0;