@@ -292,6 +292,17 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
292
292
} ;
293
293
that . telemetryService . publicLog2 < ContinueEditSessionEvent , ContinueEditSessionClassification > ( 'editSessions.continue.store' ) ;
294
294
295
+ // First ask the user to pick a destination, if necessary
296
+ let uri : URI | 'noDestinationUri' | undefined = workspaceUri ;
297
+ let destination ;
298
+ if ( ! uri ) {
299
+ destination = await that . pickContinueEditSessionDestination ( ) ;
300
+ }
301
+ if ( ! destination && ! uri ) {
302
+ return ;
303
+ }
304
+
305
+ // Determine if we need to store an edit session, asking for edit session auth if necessary
295
306
const shouldStoreEditSession = await that . shouldContinueOnWithEditSession ( ) ;
296
307
297
308
// Run the store action to get back a ref
@@ -304,17 +315,12 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
304
315
} , async ( ) => that . storeEditSession ( false ) ) ;
305
316
}
306
317
307
- let uri = workspaceUri ?? await that . pickContinueEditSessionDestination ( ) ;
318
+ // Append the ref to the URI
319
+ uri = destination ? await that . resolveDestination ( destination ) : uri ;
308
320
if ( uri === undefined ) {
309
- // If the user didn't end up picking a Continue On destination
310
- // and we stored an edit session, clean up the stored edit session
311
- if ( ref !== undefined ) {
312
- void that . editSessionsStorageService . delete ( ref ) ;
313
- }
314
321
return ;
315
322
}
316
323
317
- // Append the ref to the URI
318
324
if ( ref !== undefined && uri !== 'noDestinationUri' ) {
319
325
const encodedRef = encodeURIComponent ( ref ) ;
320
326
uri = uri . with ( {
@@ -746,7 +752,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
746
752
} ) ) ;
747
753
}
748
754
749
- private async pickContinueEditSessionDestination ( ) : Promise < URI | 'noDestinationUri' | undefined > {
755
+ private async pickContinueEditSessionDestination ( ) : Promise < string | undefined > {
750
756
const quickPick = this . quickInputService . createQuickPick < ContinueEditSessionItem > ( ) ;
751
757
752
758
const workspaceContext = this . contextService . getWorkbenchState ( ) === WorkbenchState . FOLDER
@@ -769,10 +775,10 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
769
775
770
776
quickPick . dispose ( ) ;
771
777
772
- if ( command === undefined ) {
773
- return undefined ;
774
- }
778
+ return command ;
779
+ }
775
780
781
+ private async resolveDestination ( command : string ) : Promise < URI | 'noDestinationUri' | undefined > {
776
782
try {
777
783
const uri = await this . commandService . executeCommand ( command ) ;
778
784
0 commit comments