diff options
author | Joyce Er <joyce.er@microsoft.com> | 2022-09-04 00:13:54 +0300 |
---|---|---|
committer | Joyce Er <joyce.er@microsoft.com> | 2022-09-04 00:15:38 +0300 |
commit | 253995e54e4168e09c9b63c9580ff5ba6bdfeaec (patch) | |
tree | 249d558d9068e6747e16e501ba221721c901bb48 | |
parent | 4f69cdf95a12cef48d405b38bf7812a7f297c310 (diff) |
Fix Continue On for contributions which don't return a URIdev/joyceerhl/numerous-slug
-rw-r--r-- | src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts index d847e5fbd68..a399f2b8360 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts @@ -259,18 +259,18 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo const ref = await that.storeEditSession(false); // Append the ref to the URI - if (ref !== undefined) { + if (ref !== undefined && uri !== 'noDestinationUri') { const encodedRef = encodeURIComponent(ref); uri = uri.with({ query: uri.query.length > 0 ? (uri + `&${queryParamName}=${encodedRef}`) : `${queryParamName}=${encodedRef}` }); - } else { + + // Open the URI + that.logService.info(`Opening ${uri.toString()}`); + await that.openerService.open(uri, { openExternal: true }); + } else if (ref === undefined) { that.logService.warn(`Failed to store edit session when invoking ${continueEditSessionCommand.id}.`); } - - // Open the URI - that.logService.info(`Opening ${uri.toString()}`); - await that.openerService.open(uri, { openExternal: true }); } })); } @@ -587,7 +587,7 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo })); } - private async pickContinueEditSessionDestination(): Promise<URI | undefined> { + private async pickContinueEditSessionDestination(): Promise<URI | 'noDestinationUri' | undefined> { const quickPick = this.quickInputService.createQuickPick<ContinueEditSessionItem>(); const workspaceContext = this.contextService.getWorkbenchState() === WorkbenchState.FOLDER @@ -617,6 +617,12 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo try { const uri = await this.commandService.executeCommand(command); + + // Some continue on commands do not return a URI + // to support extensions which want to be in control + // of how the destination is opened + if (uri === undefined) { return 'noDestinationUri'; } + return URI.isUri(uri) ? uri : undefined; } catch (ex) { return undefined; |