diff --git a/src/commands/git/worktree.ts b/src/commands/git/worktree.ts index cef150c..814ccc3 100644 --- a/src/commands/git/worktree.ts +++ b/src/commands/git/worktree.ts @@ -67,7 +67,7 @@ interface DeleteState { flags: DeleteFlags[]; } -type OpenFlags = '--new-window'; +type OpenFlags = '--new-window' | '--reveal-explorer'; interface OpenState { subcommand: 'open'; @@ -632,9 +632,10 @@ export class WorktreeGitCommand extends QuickCommand { }), FlagsQuickPickItem.create(state.flags, ['--force'], { label: `Force ${context.title}`, + description: 'including ANY UNCOMMITTED changes', detail: `Will forcibly delete ${pluralize('worktree', state.uris.length, { only: state.uris.length === 1, - })} even with UNCOMMITTED changes${ + })} ${ state.uris.length === 1 ? ` in $(folder) ${GitWorktree.getFriendlyPath(state.uris[0])}` : '' }`, }), @@ -678,11 +679,15 @@ export class WorktreeGitCommand extends QuickCommand { QuickCommand.endSteps(state); const worktree = context.worktrees.find(wt => wt.uri.toString() === state.uri.toString())!; - GitActions.Worktree.open(worktree, { - location: state.flags.includes('--new-window') - ? OpenWorkspaceLocation.NewWindow - : OpenWorkspaceLocation.CurrentWindow, - }); + if (state.flags.includes('--reveal-explorer')) { + void GitActions.Worktree.revealInFileExplorer(worktree); + } else { + GitActions.Worktree.open(worktree, { + location: state.flags.includes('--new-window') + ? OpenWorkspaceLocation.NewWindow + : OpenWorkspaceLocation.CurrentWindow, + }); + } } } @@ -692,11 +697,21 @@ export class WorktreeGitCommand extends QuickCommand { [ FlagsQuickPickItem.create(state.flags, [], { label: context.title, - detail: `Will open the worktree in ${GitWorktree.getFriendlyPath(state.uri)} in the current window`, + detail: `Will open, in the current window, the worktree in $(folder) ${GitWorktree.getFriendlyPath( + state.uri, + )}`, }), FlagsQuickPickItem.create(state.flags, ['--new-window'], { - label: `${context.title} in New Window`, - detail: `Will open the worktree in ${GitWorktree.getFriendlyPath(state.uri)} in a new window`, + label: `${context.title} in a New Window`, + detail: `Will open, in a new window, the worktree in $(folder) ${GitWorktree.getFriendlyPath( + state.uri, + )}`, + }), + FlagsQuickPickItem.create(state.flags, ['--reveal-explorer'], { + label: `Reveal in File Explorer`, + detail: `Will open, in the File Explorer, the worktree in $(folder) ${GitWorktree.getFriendlyPath( + state.uri, + )}`, }), ], context, diff --git a/src/commands/quickCommand.steps.ts b/src/commands/quickCommand.steps.ts index 500b82c..b3155f3 100644 --- a/src/commands/quickCommand.steps.ts +++ b/src/commands/quickCommand.steps.ts @@ -169,7 +169,7 @@ export async function getWorktrees( (typeof picked === 'string' ? w.uri.toString() === picked : picked.includes(w.uri.toString())), { buttons: buttons, - ref: true, + path: true, status: includeStatus ? await w.getStatus() : undefined, }, ), diff --git a/src/quickpicks/items/gitCommands.ts b/src/quickpicks/items/gitCommands.ts index 9dda591..a24978f 100644 --- a/src/quickpicks/items/gitCommands.ts +++ b/src/quickpicks/items/gitCommands.ts @@ -453,7 +453,7 @@ export namespace WorktreeQuickPickItem { buttons?: QuickInputButton[]; checked?: boolean; message?: boolean; - ref?: boolean; + path?: boolean; type?: boolean; status?: GitStatus; }, @@ -465,12 +465,8 @@ export namespace WorktreeQuickPickItem { if (options?.status != null) { description += options.status.hasChanges - ? pad(`Uncommited Changes (${options.status.getFormattedDiffStatus()})`, description ? 2 : 0, 0) - : pad('No Changes', description ? 2 : 0, 0); - } - - if (options?.ref) { - description += `${description ? pad(GlyphChars.Dot, 2, 2) : ''}${worktree.friendlyPath}`; + ? pad(`Uncommited changes (${options.status.getFormattedDiffStatus()})`, description ? 2 : 0, 0) + : pad('No changes', description ? 2 : 0, 0); } let icon; @@ -493,6 +489,7 @@ export namespace WorktreeQuickPickItem { const item: WorktreeQuickPickItem = { label: `${icon}${GlyphChars.Space}${label}${options?.checked ? pad('$(check)', 2) : ''}`, description: description, + detail: options?.path ? `In $(folder) ${worktree.friendlyPath}` : undefined, alwaysShow: options?.alwaysShow, buttons: options?.buttons, picked: picked,