diff --git a/package.json b/package.json index f67b8d93..ebbf18f4 100644 --- a/package.json +++ b/package.json @@ -685,7 +685,6 @@ "type": "object", "title": "Favorite commands", "required": [ - "alias", "command" ], "properties": { diff --git a/src/Settings.ts b/src/Settings.ts index c8897ccf..d4cfea88 100644 --- a/src/Settings.ts +++ b/src/Settings.ts @@ -6,7 +6,7 @@ import { Uri, workspace } from "vscode"; import { FavoriteCommand } from "./explorer/model/FavoriteCommand"; import { MavenProject } from "./explorer/model/MavenProject"; -type FavoriteFormat = {alias: string; command: string; debug?: boolean} +type FavoriteFormat = { alias?: string; command: string; debug?: boolean } export namespace Settings { export function excludedFolders(resource: Uri): string[] { const ret: string[] | undefined = _getMavenSection("excludedFolders", resource); @@ -70,7 +70,7 @@ export namespace Settings { } export function favorites(project: MavenProject): FavoriteCommand[] | undefined { - type Favorite = {alias: string, command: string, debug?: boolean}; + type Favorite = { alias: string, command: string, debug?: boolean }; return _getMavenSection("terminal.favorites", vscode.Uri.file(project.pomPath))?.map(favorite => new FavoriteCommand(project, favorite.command, favorite.alias, favorite.debug)); } } diff --git a/src/explorer/model/FavoriteCommand.ts b/src/explorer/model/FavoriteCommand.ts index ce833bc5..28099669 100644 --- a/src/explorer/model/FavoriteCommand.ts +++ b/src/explorer/model/FavoriteCommand.ts @@ -15,8 +15,8 @@ export class FavoriteCommand implements ITreeItem { } getTreeItem(): TreeItem | Thenable { - const treeItem: vscode.TreeItem = new vscode.TreeItem(this.alias, vscode.TreeItemCollapsibleState.None); - treeItem.description = this.command; + const treeItem: vscode.TreeItem = new vscode.TreeItem(this.command, vscode.TreeItemCollapsibleState.None); + treeItem.description = this.alias; treeItem.iconPath = new vscode.ThemeIcon("gear"); return treeItem; } diff --git a/src/handlers/favorites/addFavoriteHandler.ts b/src/handlers/favorites/addFavoriteHandler.ts index 7c714a50..a2080e55 100644 --- a/src/handlers/favorites/addFavoriteHandler.ts +++ b/src/handlers/favorites/addFavoriteHandler.ts @@ -22,37 +22,5 @@ export async function addFavoriteHandler() { return; } - const alias = await vscode.window.showInputBox({ - title: "Add favorite", - ignoreFocusOut: true, - prompt: "Input an alias for your favorite.", - placeHolder: "e.g. Clean and Build Project", - value: command, - validateInput: (text: string) => { - if (text.trim().length < 3) { - return "Favorite is too short."; - } - return undefined; - } - }); - - if (!alias) { - return; - } - - const executionMode = await vscode.window.showQuickPick( - ["Run", "Debug"], - { - title: "Add favorite", - placeHolder: "Select the command execution mode...", - } - ); - - if (!executionMode) { - return; - } - - // store favorite into workspace settings - const debug: boolean = executionMode === 'Debug'; - Settings.storeFavorite({alias, command, debug}); + Settings.storeFavorite({command, debug: false}); } \ No newline at end of file