Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/common/executeCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export namespace contexts {
export const RESOLVING_CONFLICTS = 'github:resolvingConflicts';
export const PULL_REQUEST_DESCRIPTION_VISIBLE = 'github:pullRequestDescriptionVisible';
export const ACTIVE_COMMENT_HAS_SUGGESTION = 'github:activeCommentHasSuggestion';
export const CREATING = 'pr:creating';
}

export namespace commands {
Expand Down
4 changes: 2 additions & 2 deletions src/github/createPRViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1174,7 +1174,7 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv

CreatePullRequestViewProvider.withProgress(() => {
return vscode.window.withProgress({ location: vscode.ProgressLocation.Notification }, async progress => {
commands.setContext('pr:creating', true);
commands.setContext(contexts.CREATING, true);
let totalIncrement = 0;
progress.report({ message: vscode.l10n.t('Checking for upstream branch'), increment: totalIncrement });
let createdPR: PullRequestModel | undefined = undefined;
Expand Down Expand Up @@ -1260,7 +1260,7 @@ export class CreatePullRequestViewProvider extends BaseCreatePullRequestViewProv
vscode.window.showErrorMessage(vscode.l10n.t('There was an error creating the pull request: {0}', (e as Error).message));
}
} finally {
commands.setContext('pr:creating', false);
commands.setContext(contexts.CREATING, false);

let completeMessage: string;
if (createdPR) {
Expand Down
6 changes: 3 additions & 3 deletions src/github/revertPRViewProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import * as vscode from 'vscode';
import { CreateParamsNew, CreatePullRequestNew } from '../../common/views';
import { openDescription } from '../commands';
import { commands } from '../common/executeCommands';
import { commands, contexts } from '../common/executeCommands';
import { ITelemetry } from '../common/telemetry';
import { IRequestMessage } from '../common/webview';
import { BaseCreatePullRequestViewProvider, BasePullRequestDataModel } from './createPRViewProvider';
Expand Down Expand Up @@ -78,7 +78,7 @@ export class RevertPullRequestViewProvider extends BaseCreatePullRequestViewProv
protected async create(message: IRequestMessage<CreatePullRequestNew>): Promise<void> {
let revertPr: PullRequestModel | undefined;
RevertPullRequestViewProvider.withProgress(async () => {
commands.setContext('pr:creating', true);
commands.setContext(contexts.CREATING, true);
try {
revertPr = await this._folderRepositoryManager.revert(this.pullRequest, message.args.title, message.args.body, message.args.draft);
if (revertPr) {
Expand All @@ -102,7 +102,7 @@ export class RevertPullRequestViewProvider extends BaseCreatePullRequestViewProv
vscode.window.showErrorMessage(vscode.l10n.t('There was an error creating the pull request: {0}', (e as Error).message));
}
} finally {
commands.setContext('pr:creating', false);
commands.setContext(contexts.CREATING, false);
if (revertPr) {
this._onDone.fire(revertPr);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/view/createPullRequestHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import * as vscode from 'vscode';
import { Repository } from '../api/api';
import { commands } from '../common/executeCommands';
import { ITelemetry } from '../common/telemetry';
import { dispose } from '../common/utils';
import { BaseCreatePullRequestViewProvider, BasePullRequestDataModel, CreatePullRequestViewProvider } from '../github/createPRViewProvider';
Expand All @@ -25,14 +26,13 @@ export class CreatePullRequestHelper implements vscode.Disposable {

private async setActiveContext(value: boolean) {
if (this._activeContext) {
await vscode.commands.executeCommand('setContext', this._activeContext, value);
await commands.setContext(this._activeContext, value);
}
}

private registerListeners(repository: Repository, usingCurrentBranchAsCompare: boolean) {
this._disposables.push(
this._createPRViewProvider!.onDone(async createdPR => {
this.setActiveContext(false);
await CreatePullRequestViewProvider.withProgress(async () => {
return this._postCreateCallback?.(createdPR);
});
Expand Down
2 changes: 1 addition & 1 deletion src/view/reviewManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ export class ReviewManager {
if (postCreate === 'checkoutDefaultBranch') {
await this._folderRepoManager.checkoutDefaultBranch(defaultBranch);
} if (postCreate === 'checkoutDefaultBranchAndShow') {
await vscode.commands.executeCommand('pr:github.focus');
await commands.executeCommand('pr:github.focus');
await this._folderRepoManager.checkoutDefaultBranch(defaultBranch);
await this._pullRequestsTree.expandPullRequest(createdPR);
} else if (postCreate === 'checkoutDefaultBranchAndCopy') {
Expand Down