mirror of
https://github.com/Microsoft/vscode
synced 2024-08-28 05:19:39 +00:00
prefix argument id with actual command (#165805)
https://github.com/microsoft/vscode/issues/165244#issuecomment-1306889823
This commit is contained in:
parent
391235a7e9
commit
ed1bc56bd8
|
@ -80,13 +80,13 @@ suite('CodeAction', () => {
|
|||
},
|
||||
tsLint: {
|
||||
abc: {
|
||||
$ident: 57,
|
||||
$ident: 'funny' + 57,
|
||||
arguments: <IMarkerData[]>[],
|
||||
id: '_internal_command_delegation',
|
||||
title: 'abc'
|
||||
},
|
||||
bcd: {
|
||||
$ident: 47,
|
||||
$ident: 'funny' + 47,
|
||||
arguments: <IMarkerData[]>[],
|
||||
id: '_internal_command_delegation',
|
||||
title: 'bcd'
|
||||
|
|
|
@ -1566,7 +1566,7 @@ export interface ISuggestDataDto {
|
|||
[ISuggestDataDtoField.additionalTextEdits]?: ISingleEditOperation[];
|
||||
[ISuggestDataDtoField.kindModifier]?: languages.CompletionItemTag[];
|
||||
// Command
|
||||
[ISuggestDataDtoField.commandIdent]?: number;
|
||||
[ISuggestDataDtoField.commandIdent]?: string;
|
||||
[ISuggestDataDtoField.commandId]?: string;
|
||||
[ISuggestDataDtoField.commandArguments]?: any[];
|
||||
// not-standard
|
||||
|
@ -1640,7 +1640,7 @@ export interface IWorkspaceEditDto {
|
|||
edits: Array<IWorkspaceFileEditDto | IWorkspaceTextEditDto | IWorkspaceCellEditDto>;
|
||||
}
|
||||
|
||||
export type ICommandDto = { $ident?: number } & languages.Command;
|
||||
export type ICommandDto = { $ident?: string } & languages.Command;
|
||||
|
||||
export interface ICodeActionDto {
|
||||
cacheId?: ChainedCacheId;
|
||||
|
|
|
@ -323,7 +323,7 @@ export const IExtHostCommands = createDecorator<IExtHostCommands>('IExtHostComma
|
|||
export class CommandsConverter implements extHostTypeConverter.Command.ICommandsConverter {
|
||||
|
||||
readonly delegatingCommandId: string = `__vsc${Date.now().toString(36)}`;
|
||||
private readonly _cache = new Map<number, vscode.Command>();
|
||||
private readonly _cache = new Map<string, vscode.Command>();
|
||||
private _cachIdPool = 0;
|
||||
|
||||
// --- conversion between internal and api commands
|
||||
|
@ -367,7 +367,7 @@ export class CommandsConverter implements extHostTypeConverter.Command.ICommands
|
|||
// we have a contributed command with arguments. that
|
||||
// means we don't want to send the arguments around
|
||||
|
||||
const id = ++this._cachIdPool;
|
||||
const id = `${command.command}/${++this._cachIdPool}`;
|
||||
this._cache.set(id, command);
|
||||
disposables.add(toDisposable(() => {
|
||||
this._cache.delete(id);
|
||||
|
@ -386,7 +386,7 @@ export class CommandsConverter implements extHostTypeConverter.Command.ICommands
|
|||
|
||||
fromInternal(command: ICommandDto): vscode.Command | undefined {
|
||||
|
||||
if (typeof command.$ident === 'number') {
|
||||
if (typeof command.$ident === 'string') {
|
||||
return this._cache.get(command.$ident);
|
||||
|
||||
} else {
|
||||
|
@ -408,7 +408,7 @@ export class CommandsConverter implements extHostTypeConverter.Command.ICommands
|
|||
this._logService.trace('CommandsConverter#EXECUTE', args[0], actualCmd ? actualCmd.command : 'MISSING');
|
||||
|
||||
if (!actualCmd) {
|
||||
return Promise.reject('actual command NOT FOUND');
|
||||
return Promise.reject(`Actual command not found, wanted to execute ${args[0]}`);
|
||||
}
|
||||
return this._commands.executeCommand(actualCmd.command, ...(actualCmd.arguments || []));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue