@@ -136,8 +136,12 @@ export class StartWorkCommand extends QuickCommand<State> {
136136 await updateContextItems ( this . container , context ) ;
137137 const result = yield * this . pickIssueStep ( state , context ) ;
138138 if ( result === StepResultBreak ) continue ;
139- state . item = result ;
140- state . action = 'start' ;
139+ if ( typeof result !== 'string' ) {
140+ state . item = result ;
141+ state . action = 'start' ;
142+ } else {
143+ state . action = result ;
144+ }
141145 }
142146
143147 const issue = state . item ?. item ?. issue ;
@@ -320,7 +324,10 @@ export class StartWorkCommand extends QuickCommand<State> {
320324 return StepResultBreak ;
321325 }
322326
323- private * pickIssueStep ( state : StepState < State > , context : Context ) : StepResultGenerator < StartWorkItem > {
327+ private * pickIssueStep (
328+ state : StepState < State > ,
329+ context : Context ,
330+ ) : StepResultGenerator < StartWorkItem | StartWorkAction > {
324331 const buildIssueItem = ( i : StartWorkItem ) => {
325332 const buttons = [ StartWorkQuickInputButton ] ;
326333 return {
@@ -347,11 +354,19 @@ export class StartWorkCommand extends QuickCommand<State> {
347354 return items ;
348355 } ;
349356
350- function getItemsAndPlaceholder ( ) {
357+ function getItemsAndPlaceholder ( ) : {
358+ placeholder : string ;
359+ items : QuickPickItemOfT < StartWorkItem | StartWorkAction > [ ] ;
360+ } {
351361 if ( ! context . result . items . length ) {
352362 return {
353- placeholder : 'All done! Take a vacation' ,
354- items : [ createDirectiveQuickPickItem ( Directive . Cancel , undefined , { label : 'OK' } ) ] ,
363+ placeholder : 'No issues found. Start work anyway.' ,
364+ items : [
365+ createQuickPickItemOfT (
366+ state . inWorktree ? 'Create a branch on a worktree' : 'Create a branch' ,
367+ 'start' ,
368+ ) ,
369+ ] ,
355370 } ;
356371 }
357372
@@ -363,14 +378,14 @@ export class StartWorkCommand extends QuickCommand<State> {
363378
364379 const { items, placeholder } = getItemsAndPlaceholder ( ) ;
365380
366- const step = createPickStep ( {
381+ const step = createPickStep < ( typeof items ) [ 0 ] > ( {
367382 title : context . title ,
368383 placeholder : placeholder ,
369384 matchOnDescription : true ,
370385 matchOnDetail : true ,
371386 items : items ,
372387 onDidClickItemButton : ( _quickpick , button , { item } ) => {
373- if ( button === StartWorkQuickInputButton ) {
388+ if ( button === StartWorkQuickInputButton && typeof item !== 'string' ) {
374389 this . startWork ( state , item ) ;
375390 return true ;
376391 }
@@ -383,7 +398,7 @@ export class StartWorkCommand extends QuickCommand<State> {
383398 return StepResultBreak ;
384399 }
385400 const element = selection [ 0 ] ;
386- return { ...element . item } ;
401+ return typeof element . item === 'string' ? element . item : { ...element . item } ;
387402 }
388403
389404 private startWork ( state : PartialStepState < State > , item ?: StartWorkItem ) {
0 commit comments