Change:
Testing on Windows 11, latest Insiders When I selected in the publish warning, the same notification toasted again. ! ! I hit Cancel again, and I was then prompted to sign into GitHub, which I already did in the browser before getting the branch toast: ! Perhaps tied to
I realize I'm now getting duplicate toasts after any option. When I selected Allow, I got the same toast again: !

Discussion:
"default": "prompt", "markdownDescription": "%config.openRepositoryInParentFolders%", "scope": "resource" <del> }, "git.publishBeforeContinueOn": { "type": "string", "enum": [ "prompt", "always", "never" ], "markdownEnumDescriptions": [ "%config.publishBeforeContinueOn.prompt%", "%config.publishBeforeContinueOn.always%", "%config.publishBeforeContinueOn.never%" ], "default": "prompt", "markdownDescription": "%config.publishBeforeContinueOn%", "scope": "resource", "tags": [ "experimental" ] </del> } } },

this.providerRegistration = vscode.workspace.registerEditSessionIdentityProvider('file', this); vscode.workspace.onWillCreateEditSessionIdentity((e) => { <del> const publishBeforeContinueOn = vscode.workspace.getConfiguration('git').get<'never' | 'always' | 'prompt'>('publishBeforeContinueOn', 'prompt'); if (publishBeforeContinueOn !== 'never') { e.waitUntil(this._onWillCreateEditSessionIdentity(e.workspaceFolder, e.token, publishBeforeContinueOn)); } </del> <ins> e.waitUntil(this._onWillCreateEditSessionIdentity(e.workspaceFolder)); </ins> }); }

} } <del> private async _onWillCreateEditSessionIdentity(workspaceFolder: vscode.WorkspaceFolder, cancellationToken: vscode.CancellationToken, publishBeforeContinueOn: 'always' | 'prompt'): Promise<void> { const cancellationPromise = createCancellationPromise(cancellationToken); await Promise.race([this._doPublish(workspaceFolder, publishBeforeContinueOn), cancellationPromise]); </del> <ins> private async _onWillCreateEditSessionIdentity(workspaceFolder: vscode.WorkspaceFolder): Promise<void> { await this._doPublish(workspaceFolder); </ins> } <del> private async _doPublish(workspaceFolder: vscode.WorkspaceFolder, publishBeforeContinueOn: 'always' | 'prompt') { </del> <ins> private async _doPublish(workspaceFolder: vscode.WorkspaceFolder) { </ins> await this.model.openRepository(path.dirname(workspaceFolder.uri.fsPath)); const repository = this.model.getRepository(workspaceFolder.uri);

// ensure that it is published before Continue On is invoked if (!repository.HEAD?.upstream && repository.HEAD?.type === RefType.Head) { <del> if (publishBeforeContinueOn === 'prompt') { const always = vscode.l10n.t('Always'); const never = vscode.l10n.t('Never'); const selection = await vscode.window.showInformationMessage( vscode.l10n.t('The current branch is not published to the remote. Would you like to publish it to access your changes elsewhere?'), { modal: true }, ...[always, never] ); switch (selection) { case always: vscode.workspace.getConfiguration('git').update('publishBeforeContinueOn', 'always'); break; case never: vscode.workspace.getConfiguration('git').update('publishBeforeContinueOn', 'never'); default: return; } </del> <ins> const publishBranch = vscode.l10n.t('Publish Branch'); const selection = await vscode.window.showInformationMessage( vscode.l10n.t('The current branch is not published to the remote. Would you like to publish it to access your changes elsewhere?'), { modal: true }, publishBranch ); if (selection !== publishBranch) { throw new vscode.CancellationError(); </ins> } <del> await vscode.window.withProgress({ location: vscode.ProgressLocation.Notification, title: vscode.l10n.t('Publishing branch...') }, async () => { await vscode.commands.executeCommand('git.publish'); }); </del> <ins> await vscode.commands.executeCommand('git.publish'); </ins> } } }

sha }; } <del> function createCancellationPromise(cancellationToken: vscode.CancellationToken) { return new Promise((resolve, _) => { if (cancellationToken.isCancellationRequested) { resolve(undefined); } cancellationToken.onCancellationRequested(() => { resolve(undefined); }); }); } </del>

} async onWillCreateEditSessionIdentity(workspaceFolder: IWorkspaceFolder, cancellationToken: CancellationToken): Promise<void> { <ins> this._logService.debug('Running onWillCreateEditSessionIdentity participants...'); // TODO@joyceerhl show progress notification? </ins> for (const participant of this._participants) { await participant.participate(workspaceFolder, cancellationToken); } <ins> this._logService.debug(`Done running ${this._participants.length} onWillCreateEditSessionIdentity participants.`); </ins> } private _participants: IEditSessionIdentityCreateParticipant[] = [];