Skip to content

Commit c0e7b29

Browse files
authored
Ask for Continue On selection before auth (microsoft#165734)
1 parent d5125cb commit c0e7b29

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,17 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
292292
};
293293
that.telemetryService.publicLog2<ContinueEditSessionEvent, ContinueEditSessionClassification>('editSessions.continue.store');
294294

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
295306
const shouldStoreEditSession = await that.shouldContinueOnWithEditSession();
296307

297308
// Run the store action to get back a ref
@@ -304,17 +315,12 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
304315
}, async () => that.storeEditSession(false));
305316
}
306317

307-
let uri = workspaceUri ?? await that.pickContinueEditSessionDestination();
318+
// Append the ref to the URI
319+
uri = destination ? await that.resolveDestination(destination) : uri;
308320
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-
}
314321
return;
315322
}
316323

317-
// Append the ref to the URI
318324
if (ref !== undefined && uri !== 'noDestinationUri') {
319325
const encodedRef = encodeURIComponent(ref);
320326
uri = uri.with({
@@ -746,7 +752,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
746752
}));
747753
}
748754

749-
private async pickContinueEditSessionDestination(): Promise<URI | 'noDestinationUri' | undefined> {
755+
private async pickContinueEditSessionDestination(): Promise<string | undefined> {
750756
const quickPick = this.quickInputService.createQuickPick<ContinueEditSessionItem>();
751757

752758
const workspaceContext = this.contextService.getWorkbenchState() === WorkbenchState.FOLDER
@@ -769,10 +775,10 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
769775

770776
quickPick.dispose();
771777

772-
if (command === undefined) {
773-
return undefined;
774-
}
778+
return command;
779+
}
775780

781+
private async resolveDestination(command: string): Promise<URI | 'noDestinationUri' | undefined> {
776782
try {
777783
const uri = await this.commandService.executeCommand(command);
778784

0 commit comments

Comments
 (0)