Short title for command contribution.

This commit is contained in:
rebornix
2021-05-20 11:47:12 -07:00
parent 29c61570a5
commit af0c01b1e3
3 changed files with 16 additions and 3 deletions

View File

@@ -438,6 +438,7 @@ namespace schema {
export interface IUserFriendlyCommand {
command: string;
title: string | ILocalizedString;
shortTitle?: string | ILocalizedString;
enablement?: string;
category?: string | ILocalizedString;
icon?: IUserFriendlyIcon;
@@ -457,6 +458,9 @@ namespace schema {
if (!isValidLocalizedString(command.title, collector, 'title')) {
return false;
}
if (command.shortTitle && !isValidLocalizedString(command.shortTitle, collector, 'shortTitle')) {
return false;
}
if (command.enablement && typeof command.enablement !== 'string') {
collector.error(localize('optstring', "property `{0}` can be omitted or must be of type `string`", 'precondition'));
return false;
@@ -510,6 +514,10 @@ namespace schema {
description: localize('vscode.extension.contributes.commandType.title', 'Title by which the command is represented in the UI'),
type: 'string'
},
shortTitle: {
description: localize('vscode.extension.contributes.commandType.shortTitle', 'Short 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'
@@ -567,7 +575,7 @@ commandsExtensionPoint.setHandler(extensions => {
return;
}
const { icon, enablement, category, title, command } = userFriendlyCommand;
const { icon, enablement, category, title, shortTitle, command } = userFriendlyCommand;
let absoluteIcon: { dark: URI; light?: URI; } | ThemeIcon | undefined;
if (icon) {
@@ -588,6 +596,7 @@ commandsExtensionPoint.setHandler(extensions => {
bucket.push({
id: command,
title,
shortTitle,
category,
precondition: ContextKeyExpr.deserialize(enablement),
icon: absoluteIcon