Skip to content

Commit

Permalink
extension host: use UUID for delegatingCommandId instead of `Date.n…
Browse files Browse the repository at this point in the history
…ow()` 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
  • Loading branch information
ulugbekna committed Nov 16, 2023
1 parent 7d4091a commit 4f41508
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/vs/workbench/api/common/extHostCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -342,7 +343,7 @@ export const IExtHostCommands = createDecorator<IExtHostCommands>('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<string, vscode.Command>();
private _cachIdPool = 0;

Expand Down

0 comments on commit 4f41508

Please sign in to comment.