@@ -1764,41 +1764,40 @@ export function* pickStashStep<
17641764 context : Context ,
17651765 {
17661766 ignoreFocusOut,
1767- gitStash ,
1767+ stash ,
17681768 picked,
17691769 placeholder,
17701770 title,
17711771 } : {
17721772 ignoreFocusOut ?: boolean ;
1773- gitStash : GitStash | undefined ;
1773+ stash : GitStash | undefined ;
17741774 picked : string | string [ ] | undefined ;
17751775 placeholder : string | ( ( context : Context , stash : GitStash | undefined ) => string ) ;
17761776 title ?: string ;
17771777 } ,
17781778) : StepResultGenerator < GitStashCommit > {
17791779 const step = createPickStep < CommitQuickPickItem < GitStashCommit > > ( {
17801780 title : appendReposToTitle ( title ?? context . title , state , context ) ,
1781- placeholder : typeof placeholder === 'string' ? placeholder : placeholder ( context , gitStash ) ,
1781+ placeholder : typeof placeholder === 'string' ? placeholder : placeholder ( context , stash ) ,
17821782 ignoreFocusOut : ignoreFocusOut ,
17831783 matchOnDescription : true ,
17841784 matchOnDetail : true ,
1785- items :
1786- gitStash == null
1787- ? [ createDirectiveQuickPickItem ( Directive . Back , true ) , createDirectiveQuickPickItem ( Directive . Cancel ) ]
1788- : [
1789- ...map ( gitStash . stashes . values ( ) , stash =>
1790- createStashQuickPickItem (
1791- stash ,
1792- picked != null &&
1793- ( typeof picked === 'string' ? stash . ref === picked : picked . includes ( stash . ref ) ) ,
1794- {
1795- buttons : [ ShowDetailsViewQuickInputButton ] ,
1796- compact : true ,
1797- icon : true ,
1798- } ,
1799- ) ,
1785+ items : ! stash ?. stashes . size
1786+ ? [ createDirectiveQuickPickItem ( Directive . Back , true ) , createDirectiveQuickPickItem ( Directive . Cancel ) ]
1787+ : [
1788+ ...map ( stash . stashes . values ( ) , stash =>
1789+ createStashQuickPickItem (
1790+ stash ,
1791+ picked != null &&
1792+ ( typeof picked === 'string' ? stash . ref === picked : picked . includes ( stash . ref ) ) ,
1793+ {
1794+ buttons : [ ShowDetailsViewQuickInputButton ] ,
1795+ compact : true ,
1796+ icon : true ,
1797+ } ,
18001798 ) ,
1801- ] ,
1799+ ) ,
1800+ ] ,
18021801 onDidClickItemButton : ( _quickpick , button , { item } ) => {
18031802 if ( button === ShowDetailsViewQuickInputButton ) {
18041803 void StashActions . showDetailsView ( item , { pin : false , preserveFocus : true } ) ;
@@ -1822,13 +1821,13 @@ export function* pickStashesStep<
18221821 context : Context ,
18231822 {
18241823 ignoreFocusOut,
1825- gitStash ,
1824+ stash ,
18261825 picked,
18271826 placeholder,
18281827 title,
18291828 } : {
18301829 ignoreFocusOut ?: boolean ;
1831- gitStash : GitStash | undefined ;
1830+ stash : GitStash | undefined ;
18321831 picked : string | string [ ] | undefined ;
18331832 placeholder : string | ( ( context : Context , stash : GitStash | undefined ) => string ) ;
18341833 title ?: string ;
@@ -1837,27 +1836,26 @@ export function* pickStashesStep<
18371836 const step = createPickStep < CommitQuickPickItem < GitStashCommit > > ( {
18381837 title : appendReposToTitle ( title ?? context . title , state , context ) ,
18391838 multiselect : true ,
1840- placeholder : typeof placeholder === 'string' ? placeholder : placeholder ( context , gitStash ) ,
1839+ placeholder : typeof placeholder === 'string' ? placeholder : placeholder ( context , stash ) ,
18411840 ignoreFocusOut : ignoreFocusOut ,
18421841 matchOnDescription : true ,
18431842 matchOnDetail : true ,
1844- items :
1845- gitStash == null
1846- ? [ createDirectiveQuickPickItem ( Directive . Back , true ) , createDirectiveQuickPickItem ( Directive . Cancel ) ]
1847- : [
1848- ...map ( gitStash . stashes . values ( ) , stash =>
1849- createStashQuickPickItem (
1850- stash ,
1851- picked != null &&
1852- ( typeof picked === 'string' ? stash . ref === picked : picked . includes ( stash . ref ) ) ,
1853- {
1854- buttons : [ ShowDetailsViewQuickInputButton ] ,
1855- compact : true ,
1856- icon : true ,
1857- } ,
1858- ) ,
1843+ items : ! stash ?. stashes . size
1844+ ? [ createDirectiveQuickPickItem ( Directive . Back , true ) , createDirectiveQuickPickItem ( Directive . Cancel ) ]
1845+ : [
1846+ ...map ( stash . stashes . values ( ) , stash =>
1847+ createStashQuickPickItem (
1848+ stash ,
1849+ picked != null &&
1850+ ( typeof picked === 'string' ? stash . ref === picked : picked . includes ( stash . ref ) ) ,
1851+ {
1852+ buttons : [ ShowDetailsViewQuickInputButton ] ,
1853+ compact : true ,
1854+ icon : true ,
1855+ } ,
18591856 ) ,
1860- ] ,
1857+ ) ,
1858+ ] ,
18611859 onDidClickItemButton : ( _quickpick , button , { item } ) => {
18621860 if ( button === ShowDetailsViewQuickInputButton ) {
18631861 void StashActions . showDetailsView ( item , { pin : false , preserveFocus : true } ) ;
0 commit comments