user.collector.error(localize('optstring',"property `{0}` can be omitted or must be of type `string`",'when'));
returnfalse;
}
if(!isValidIcon(candidate.icon,user)){
returnfalse;
}
if(!isValidWhere(candidate.where,user)){
returnfalse;
}
returntrue;
}
}
namespaceschema{
constcommandType:IJSONSchema={
type:'object',
properties:{
command:{
description:localize('vscode.extension.contributes.commandType.command','Identifier of the command to execute'),
type:'string'
},
title:{
description:localize('vscode.extension.contributes.commandType.title','Title by which the command is represented in the UI'),
type:'string'
},
category:{
description:localize('vscode.extension.contributes.commandType.category','(Optional) Category string by the command is grouped in the UI'),
type:'string'
},
icon:{
description:localize('vscode.extension.contributes.commandType.icon','(Optional) Icon which is used to represent the command in the UI. Either a file path or a themable configuration'),
anyOf:[
'string',
{
type:'object',
properties:{
light:{
description:localize('vscode.extension.contributes.commandType.icon.light','Icon path when a light theme is used'),
type:'string'
},
dark:{
description:localize('vscode.extension.contributes.commandType.icon.dark','Icon path when a dark theme is used'),
type:'string'
}
}
}
]
},
when:{
description:localize('vscode.extension.contributes.commandType.context.when',"Condition that must be met in order to show the command."),
type:'string'
},
where:{
description:localize('vscode.extension.contributes.commandType.context.where',"Menus and tool bars to which commands can be added, e.g. `editor title actions` or `explorer context menu`"),
enum:[
'editor/primary',
'editor/secondary'
]
}
}
};
exportconstcommandContribution:IJSONSchema={
description:localize('vscode.extension.contributes.commands',"Contributes commands to the command palette."),
collector.error(localize('opticon',"property `icon` can be omitted or must be either a string or a literal like `{dark, light}`"));
returnfalse;
}
constcommandType:IJSONSchema={
type:'object',
properties:{
command:{
description:localize('vscode.extension.contributes.commandType.command','Identifier of the command to execute'),
type:'string'
},
title:{
description:localize('vscode.extension.contributes.commandType.title','Title by which the command is represented in the UI'),
type:'string'
},
category:{
description:localize('vscode.extension.contributes.commandType.category','(Optional) Category string by the command is grouped in the UI'),
type:'string'
},
icon:{
description:localize('vscode.extension.contributes.commandType.icon','(Optional) Icon which is used to represent the command in the UI. Either a file path or a themable configuration'),
anyOf:[
'string',
{
type:'object',
properties:{
light:{
description:localize('vscode.extension.contributes.commandType.icon.light','Icon path when a light theme is used'),
type:'string'
},
dark:{
description:localize('vscode.extension.contributes.commandType.icon.dark','Icon path when a dark theme is used'),
type:'string'
}
}
}
]
}
}
};
}
exportinterfaceMenuItem{
command:string;
alt:string;
}
exportinterfaceMenus{
'editor/primary':MenuItem[];
'editor/secondary':MenuItem[];
exportconstcommandsContribution:IJSONSchema={
description:localize('vscode.extension.contributes.commands',"Contributes commands to the command palette."),