Skip to content

Commit dcece58

Browse files
committed
Creates branch suggesting a name based on selected issue
(#3621, #3698)
1 parent 33fad37 commit dcece58

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

src/plus/startWork/startWork.ts

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
QuickCommand,
1717
StepResultBreak,
1818
} from '../../commands/quickCommand';
19+
import { getSteps } from '../../commands/quickWizard.utils';
1920
import { proBadge } from '../../constants';
2021
import type { IntegrationId } from '../../constants.integrations';
2122
import { HostingIntegrationId } from '../../constants.integrations';
@@ -24,6 +25,7 @@ import type { Container } from '../../container';
2425
import type { SearchedIssue } from '../../git/models/issue';
2526
import type { QuickPickItemOfT } from '../../quickpicks/items/common';
2627
import { createQuickPickItemOfT } from '../../quickpicks/items/common';
28+
import type { DirectiveQuickPickItem } from '../../quickpicks/items/directive';
2729
import { createDirectiveQuickPickItem, Directive } from '../../quickpicks/items/directive';
2830
import { getScopedCounter } from '../../system/counter';
2931
import { fromNow } from '../../system/date';
@@ -138,7 +140,19 @@ export class StartWorkCommand extends QuickCommand<State> {
138140
if (typeof state.action === 'string') {
139141
switch (state.action) {
140142
case 'start':
141-
startWork(state.item.item);
143+
yield* getSteps(
144+
this.container,
145+
{
146+
command: 'branch',
147+
state: {
148+
subcommand: 'create',
149+
repo: undefined,
150+
name: `${state.item.item.issue.id}-${state.item.item.issue.title}`,
151+
suggestNameOnly: true,
152+
},
153+
},
154+
this.pickedVia,
155+
);
142156
break;
143157
}
144158
}
@@ -332,6 +346,13 @@ export class StartWorkCommand extends QuickCommand<State> {
332346
return { ...element.item };
333347
}
334348

349+
private startWork(state: PartialStepState<State>, item?: StartWorkItem) {
350+
state.action = 'start';
351+
if (item != null) {
352+
state.item = item;
353+
}
354+
}
355+
335356
private async getConnectedIntegrations(): Promise<Map<IntegrationId, boolean>> {
336357
const connected = new Map<IntegrationId, boolean>();
337358
await Promise.allSettled(
@@ -353,7 +374,3 @@ async function updateContextItems(container: Container, context: Context) {
353374
})) ?? [],
354375
};
355376
}
356-
357-
function startWork(_issue: SearchedIssue) {
358-
// TODO: Hack here
359-
}

0 commit comments

Comments
 (0)