Просмотр исходного кода

Adds a modal to worktree creation flow

main
Eric Amodio 1 год назад
Родитель
Сommit
16d5b770f5
1 измененных файлов: 14 добавлений и 6 удалений
  1. +14
    -6
      src/commands/git/worktree.ts

+ 14
- 6
src/commands/git/worktree.ts Просмотреть файл

@ -322,6 +322,7 @@ export class WorktreeGitCommand extends QuickCommand {
icon: false,
label: state.reference.refType !== 'branch',
})}`,
defaultUri: context.defaultUri,
});
if (result === StepResult.Break) continue;
@ -478,21 +479,28 @@ export class WorktreeGitCommand extends QuickCommand {
private async *createCommandChoosePathStep(
state: CreateStepState,
context: Context,
options?: { titleContext?: string },
options: { titleContext: string; defaultUri?: Uri },
): AsyncStepResultGenerator<Uri> {
const step = QuickCommand.createCustomStep<Uri>({
show: async (_step: CustomStep<Uri>) => {
const hasDefault = options?.defaultUri != null;
const result = await window.showInformationMessage(
`Choose a location in which to create the worktree${options.titleContext}.`,
{ modal: true },
{ title: 'Choose Location' },
...(hasDefault ? [{ title: 'Use Default Location' }] : []),
);
if (result == null) return Directive.Back;
if (result.title === 'Use Default Location') return options.defaultUri!;
const uris = await window.showOpenDialog({
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: context.pickedUri ?? state.uri ?? context.defaultUri,
openLabel: 'Select Worktree Location',
title: `${appendReposToTitle(
`Choose Worktree Location${options?.titleContext ?? ''}`,
state,
context,
)}`,
title: `${appendReposToTitle(`Choose a Worktree Location${options.titleContext}`, state, context)}`,
});
if (uris == null || uris.length === 0) return Directive.Back;

Загрузка…
Отмена
Сохранить