@@ -113,7 +113,7 @@ export class Commands {
113113 void this . runOnRepository (
114114 repositoryNode ,
115115 ( repositoryNode : RepositoryNode ) => { this . stashPerform ( repositoryNode ) } ,
116- 'Create stash ' ,
116+ 'Create Stash ' ,
117117 )
118118 }
119119
@@ -126,7 +126,7 @@ export class Commands {
126126 void this . runOnRepository (
127127 repositoryNode ,
128128 ( repositoryNode : RepositoryNode ) => { this . clearPerform ( repositoryNode ) } ,
129- 'Clear stashes ' ,
129+ 'Drop All Stashes ' ,
130130 )
131131 }
132132
@@ -139,7 +139,7 @@ export class Commands {
139139 this . runOnStash (
140140 stashNode ,
141141 ( stashNode : StashNode ) => { this . popPerform ( stashNode ) } ,
142- 'Stash pop ' ,
142+ 'Pop Stash ' ,
143143 )
144144 }
145145
@@ -152,7 +152,7 @@ export class Commands {
152152 this . runOnStash (
153153 stashNode ,
154154 ( stashNode : StashNode ) => { this . applyPerform ( stashNode ) } ,
155- 'Stash apply ' ,
155+ 'Apply Stash ' ,
156156 )
157157 }
158158
@@ -165,7 +165,7 @@ export class Commands {
165165 this . runOnStash (
166166 stashNode ,
167167 ( stashNode : StashNode ) => { this . branchPerform ( stashNode ) } ,
168- 'Stash branch ' ,
168+ 'Branch Stash ' ,
169169 )
170170 }
171171
@@ -178,7 +178,21 @@ export class Commands {
178178 this . runOnStash (
179179 stashNode ,
180180 ( stashNode : StashNode ) => { this . dropPerform ( stashNode ) } ,
181- 'Stash drop' ,
181+ 'Drop stash' ,
182+ )
183+ }
184+
185+ /**
186+ * Drops the currently selected stash or selects one and continue.
187+ *
188+ * @param stashNode the involved node
189+ */
190+ public multiDrop = ( ) : void => {
191+ this . runOnStash (
192+ undefined ,
193+ ( ...nodes : StashNode [ ] ) => { this . multiDropPerform ( ...nodes ) } ,
194+ 'Drop Multiple Stashes' ,
195+ true ,
182196 )
183197 }
184198
@@ -229,12 +243,16 @@ export class Commands {
229243 ]
230244
231245 void vscode . window
232- . showQuickPick ( opts , { placeHolder : `Create stash › ${ repositoryLabel } › ...` } )
246+ . showQuickPick ( opts , {
247+ title : 'Create Stash' ,
248+ placeHolder : `${ repositoryLabel } › ...` ,
249+ } )
233250 . then ( ( option ) => {
234251 if ( typeof option !== 'undefined' ) {
235252 void vscode . window
236253 . showInputBox ( {
237- placeHolder : `Create stash › ${ repositoryLabel } › ${ option . label } › ...` ,
254+ title : 'Create Stash' ,
255+ placeHolder : `${ repositoryLabel } › ${ option . label } › ...` ,
238256 prompt : 'Optionally provide a stash message' ,
239257 } )
240258 . then ( ( stashMessage ) => {
@@ -293,13 +311,15 @@ export class Commands {
293311 withIndex : true ,
294312 } ,
295313 ] ,
296- { placeHolder : `Stash pop › ${ repositoryLabel } › ${ stashLabel } › ...` } ,
297- )
298- . then ( ( option ) => {
299- if ( typeof option !== 'undefined' ) {
300- this . stashCommands . pop ( stashNode , option . withIndex )
301- }
302- } )
314+ {
315+ title : 'Pop Stash' ,
316+ placeHolder : `${ repositoryLabel } › ${ stashLabel } › ...` ,
317+ } ,
318+ ) . then ( ( option ) => {
319+ if ( typeof option !== 'undefined' ) {
320+ this . stashCommands . pop ( stashNode , option . withIndex )
321+ }
322+ } )
303323 }
304324
305325 /**
@@ -324,7 +344,10 @@ export class Commands {
324344 withIndex : true ,
325345 } ,
326346 ] ,
327- { placeHolder : `Stash apply › ${ repositoryLabel } › ${ stashLabel } › ...` } ,
347+ {
348+ title : 'Apply Stash' ,
349+ placeHolder : `${ repositoryLabel } › ${ stashLabel } › ...` ,
350+ } ,
328351 )
329352 . then ( ( option ) => {
330353 if ( typeof option !== 'undefined' ) {
@@ -344,7 +367,8 @@ export class Commands {
344367
345368 void vscode . window
346369 . showInputBox ( {
347- placeHolder : `Stash apply › ${ repositoryLabel } › ${ stashLabel } › ...` ,
370+ title : 'Apply Stash' ,
371+ placeHolder : `${ repositoryLabel } › ${ stashLabel } › ...` ,
348372 prompt : 'Write a name' ,
349373 } )
350374 . then ( ( branchName ) => {
@@ -380,6 +404,35 @@ export class Commands {
380404 } )
381405 }
382406
407+ private multiDropPerform = ( ...nodes : StashNode [ ] ) : void => {
408+ if ( ! nodes . length ) {
409+ vscode . window . showInformationMessage ( 'Nothing to drop.' )
410+ return
411+ }
412+
413+ const textList = nodes
414+ . map ( ( node ) => this . stashLabels . getName ( node ) )
415+ . join ( '\n' )
416+
417+ const msg = `Are you sure you want to drop the stashes?\n${ textList } `
418+
419+ void vscode . window . showWarningMessage < vscode . MessageItem > (
420+ msg ,
421+ { modal : true } ,
422+ { title : 'Yes' } ,
423+ ) . then ( ( option ) => {
424+ if ( typeof option !== 'undefined' ) {
425+ nodes
426+ // Higher index first.
427+ . sort ( ( a , b ) => a . index > b . index ? - 1 : ( a . index < b . index ? 1 : 0 ) )
428+ . forEach ( ( node ) => {
429+ console . log ( `Multi-dropping ${ node . atIndex } ` )
430+ this . stashCommands . drop ( node )
431+ } )
432+ }
433+ } )
434+ }
435+
383436 /**
384437 * Applies the changes on the stashed file.
385438 *
@@ -500,7 +553,11 @@ export class Commands {
500553
501554 const selection = await vscode . window . showQuickPick < QuickPickRepositoryNodeItem > (
502555 items ,
503- { placeHolder : `${ pickerPlaceholder } › ...` , canPickMany : false } ,
556+ {
557+ title : pickerPlaceholder ,
558+ placeHolder : '› Select Repository' ,
559+ canPickMany : false ,
560+ } ,
504561 )
505562
506563 if ( selection ) {
@@ -557,7 +614,8 @@ export class Commands {
557614 }
558615
559616 const options = {
560- placeHolder : `${ placeholder } › ${ repositoryLabel } › ...` ,
617+ title : placeholder ,
618+ placeHolder : `${ repositoryLabel } › ...` ,
561619 canPickMany,
562620 }
563621
0 commit comments